10. A Complete Application#
In class you have created the three fundamental components of an application:
A pod definition to define your executable code, CPU and memory requests.
A service definition to make your pod reachable on the network.
A persistent volume claim to hold your precious data.
To complete this milestone you have to verify that all of the components work together. The deployment directory should look like this:
$ tree deployment
deployment
├── pod.yaml
├── service.yaml
├── config.yaml
├── secret.yaml
└── pvc.yaml
Release#
Before you submit this milestone make a GitHub release named milestone-10.x. Making a new release will trigger a build of your Dockerfile, which should be no different than the milestone-6.x release. You can use the newer release tag in your pod or you can use the older release tag.
Test Procedure#
This is a release of what should be a complete and working, though not scalable, application. Keep that in mind when you’re testing it. An end user should be able to apply the resources, create a superuser and go! To test you’ll use minikube which is a stripped down Kubernetes that is used for debugging locally.
Only Test a Release
It’s essential to only test the code snapshot in a release, not the main branch. Your reviewee should have posted a URL like this:
https://github.com/your-name/your-cis-92-repo/releases/tag/milestone-10.1
Notice that it ends with releases/tag/mileston-10.1. If it doesn’t look like that they posted a link to the main branch. Stop and let them know.
The test procedure is:
Open the milestone in GitHub Codespaces. Make sure it’s the milestone release, not
mainOpen
deployment/config.yamland verify that the following settings are present:Variable
Value
PORT8000STUDENT_NAMECan be anything
SITE_NAMECan be anything
DATA_DIR/dataDEBUG1Error
If any are missing or set incorrectly send a report with the specific variable names and the correct value.
Open
deployment/secret.yamland verify the following settings are present:Variable
Value
SECRET_KEYCan be anything
Error
If any are missing or set incorrectly send a report with the specific variable names and the correct value.
Start
minikube$ minikube start
Apply all resources in the
deploymentdirectory.$ kubectl apply -f deployment/
Note
It takes applications a little while to get ready. Check that it’s working by running:
$ kubectl get all
Verify that the
PersistentVolumeClaimhas been bound:$ kubectl get pvc
Error
Verify that the volume claim is in the
Boundstate. Stop if it is not.Initialize database.
$ kubectl exec --stdin --tty pod/mysite-pod -- python manage.py migrate $ kubectl exec --stdin --tty pod/mysite-pod -- python manage.py createsuperuser
Error
Verify that the database has not previously been initialized and create a new superuser account.
Login using the new account using a forwarded port.
$ kubectl port-forward svc/mysite-svc 8000:80
Error
Make sure all of the pages of the app work and that the student and site names match the configuration.
Delete and restart the pod. Doing this should not affect the database.
$ kubectl delete pod/mysite-pod $ kubectl apply -f deployment/ $ kubectl port-forward svc/mysite-svc 8000:80
Error
Verify that your credentials still work. If they don’t alert the reviewee
Take a screenshot of the administrative interface with the user you created.
Requirements#
A
Poddefinition for Django that includes:Reasonable resource requests:
At least 250m but not more than 1000m CPUs
At least 128Mi of memory but not more than 1Gi of memory
A
Servicedefinition for Django with typeLoadBalancerA
PersistentVolumeClaimfor your application mounted on/data
Submit#
Tag this milestone
milestone-10.x.A URL to your release. It should look like this:
https://github.com/your-name/your-cis-92-repo/releases/tag/milestone-10.1