10.4. Test Your App Updates#
After you’ve made the updates to your application you should commit and push the updates to GitHub. This will not automatically build a new container for you. Instead you have to go to GitHub and manually build the container as I showed you in class.
Update the Container Image#
Once you have built your new container, obtain the container hash as I
demonstrated in class and put it in your deployment/pod.yaml file:
...
spec:
containers:
- name: django
image: ghcr.io/mike-matera/cis-92-sp26@sha256:4226d2988b2550a87fb7df2dff75d8c9ac06ef201f41653b5b6f5c8862d512d3
ports:
- containerPort: 8080
...
Update this snippet with your image not mine!
Cleanup Unnecessary Files#
You no longer need the PersistentVolumeClaim resource in your deployment
directory. You can delete it:
$ rm deployment/pvc.yaml
Launch Your Application#
Now you should be able to deploy your upgraded application with the following commands:
$ helm install postgres oci://registry-1.docker.io/bitnamicharts/postgresql --values values-postgres.yaml
$ kubectl apply -f deployment/
If all the passwords in your values-postgres.yaml and deployment/secret.ytml
match your site should come up in a couple of minutes.
Stop Your Application (and Keep the Data)#
To stop your application while it’s running you should uninstall postgres and remove your deployment resources:
$ kubectl delete -f deployment/
$ helm uninstall postgres
Delete Your Data and Reset the DB#
The data is preserved. To remove it you need to delete the PVC resource that’s a part of Postgres:
$ kubectl delete pvc data-postgres-postgresql-0
Now you can reset the database password and start over.