This is a cookiecutter template for Django-Hurricane-based Helm charts.
It provides workload manifests for a Django deployment and a PostgreSQL. In addition, you
can generate a Celery setup with RabbitMQ as broker,
a Celery worker and beat deployment.
This template is used to scaffold a Helm
chart for applications using django-hurricane.
It sets required environment variables and should replace 90% for all docker-compose
setups with django and a postgresql.
Firstly, you will need to install cookiecutter:
pip install cookiecutter
Create a new Helm chart with
cookiecutter gh:Blueshoe/hurricane-based-helm-template
and answer the questions accordingly.
It is generally considered more secure to run containers with a user other than root
. Our
Dockerfiles usually incorporate a special user to run the application. For development
environments such as k3d
we're using local-path
provisioner for local volume creation.
This storage class does not honor the fsGroup
option and volumes get still mounted with root
owner
which leads to permission issues.
Anyway, volumePermissions.enabled: true
is set as default, which starts an initContainer
that simply
chown
s the requested volume mounts. However, you have to set
podSecurityContext.fsGroup and podSecurityContext.runAsUser
to make this work.
For a robust OpenID Connect integration we prefer to deploy the OAuth2-Proxy in a sidecar pattern scenario. The architecture is then as depicted in the following image.
Django will be additionally equipped with pycloak in order to use an external
OpenID identity provider, such as Keycloak, for user and permission management. Once you
answer Cookiecutters "use_oauth2_proxy" with "yes", you will get the sidecare specification prepared.
Beware: the Helm charts wont come up without the OIDC provider running at the specified location.
The simplest solution to test your generated Helm charts is by applying them to an ephemeral cluster using k3d
.
k3d cluster create my-test
Make sure your local kubectl
connection is set to the cluster which you just created.
helm dep up <appname>/
helm install my-release <appname>/
and keep an eye on the Pods running
kubectl get pods