Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 1.26 KB

new-kubernetes-knowledge.md

File metadata and controls

38 lines (34 loc) · 1.26 KB

Basics

  1. Apply all deployments:
kubectl kustomize k8s | kubectl apply -f -
  1. Delete all deployments:
kubectl delete pods --all

Persistent Volumes and their Claims

  1. Create directory called .kubernetes_storage in the root of the project
  2. Create directory in .kubernetes_storage called db-volume
  3. Create directory in .kubernetes_storage called static-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.

Secrets

  1. Creating secrets from .web-env.kubernetes
kubectl create secret generic web-env --from-env-file=./.web-env.kubernetes
  1. Creating db secrets from .db-credentials.kubernetes
kubectl create secret generic db-credentials --from-env-file=./.db-credentials.kubernetes
  1. Creating NGINX ConfigMap from ./nginx/nginx.conf
kubectl create configmap nginx-config --from-file=./nginx/nginx.conf

If staticfiles are not working:

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