Gunicorn
- Franco Luciano Forneron Buschiazzo
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 45 | 25 Nov 2022 | |
latest/edge | 98 | 02 May 2024 |
juju deploy gunicorn-k8s
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
How to use cross model relations
In some settings it can be useful to relate the charm to the influxDB charm, and in order to do that we have to utilize cross-model relations. First, create a suitable machine model on the cloud of your choice:
juju switch influxmodel
juju deploy influxdb
juju offer influxdb:query influxoffer
Then we will need to switch back to gunicorn’s model and relate the charm with influx’s offer:
juju switch gunicorn-test # assuming you've deployed Gunicorn into a k8s model called "gunicorn-test"
juju relate gunicorn-k8s localhost-localhost:admin/influxmodel.influxoffer # assuming your machine controller is called localhost-localhost, that is the default value.
Also, it can be useful to deploy the database (PostgreSQL) in a different cloud, for example LXD or OpenStack, and integrate Gunicorn with it via cross-model relations. First, create a suitable model on the cloud of your choice:
juju switch database
juju deploy postgresql
juju offer postgresql:db
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 gunicorn-test # assuming you've deployed gunicorn into a k8s model called "gunicorn-test"
juju find-offers # note down offer URL; example used below:
It’s also possible you’ll need to grant specific access to the user you want to join the relation from. If you don’t see any output from the find-offers command, and run juju whoami to confirm your account name and then from the PostgreSQL model run juju grant ${user} consume ${offer-url}. Once you have something showing up in the output of juju find-offers you can proceed to the next step.
juju relate gunicorn-k8s 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.)