- Apply all deployments:
kubectl kustomize k8s | kubectl apply -f -
- Delete all deployments:
kubectl delete pods --all
- Create directory called
.kubernetes_storage
in the root of the project - Create directory in
.kubernetes_storage
calleddb-volume
- Create directory in
.kubernetes_storage
calledstatic-volume
Now, when we specify the PV and PVC, we can use the hostPath
to specify the path to the directory we just created.
This allows us to have a persistent volume that is not tied to a specific node.
- Creating secrets from .web-env.kubernetes
kubectl create secret generic web-env --from-env-file=./.web-env.kubernetes
- Creating db secrets from .db-credentials.kubernetes
kubectl create secret generic db-credentials --from-env-file=./.db-credentials.kubernetes
- Creating NGINX ConfigMap from ./nginx/nginx.conf
kubectl create configmap nginx-config --from-file=./nginx/nginx.conf
kubectl exec -it <web-pod-name> -- python manage.py makemigrations
kubectl exec -it <web-pod-name> -- python manage.py migrate
kubectl exec -it <web-pod-name> -- python manage.py collectstatic --no-input