The charm will not function without a connection to a PostgreSQL database and Redis, so you will need to deploy these somewhere.
Deploying Redis to another Juju model on IaaS
Create a suitable model on a different cloud, for example, LXD or OpenStack.
juju switch database
juju deploy cs:~redis-charmers/redis # Note the IP as ${REDIS_IP}
Then set the appropriate juju config in your k8s model:
juju switch discourse-test
juju config discourse redis_host=${REDIS_IP}
Deploying PostgreSQL to the same model on Kubernetes
To deploy PostgreSQL to the same kubernetes model as Discourse:
juju switch discourse-test
juju deploy cs:~postgresql-charmers/postgresql-k8s postgresql
Then simply use juju relate discourse postgresql:db-admin
. This deployment style is recommended for testing purposes only.
Deploying PostgreSQL to another Juju model on IaaS
Cross-model relations are also supported. Create a suitable model on a different cloud, for example, LXD or OpenStack.
juju switch database
juju deploy cs:postgresql
juju offer postgresql:db-admin
In most k8s deployments, traffic to external services from worker pods will be SNATed by some part of the infrastructure. You will need to know what the source addresses or address range is for the next step.
juju switch discourse-test
juju find-offers # note down offer URL; example used below:
juju relate discourse admin/database.postgresql --via 10.9.8.0/24
(In the case of postgresql, --via
is needed so that the charm can configure pga_hba.conf
to let the k8s pods connect to the database.)