This is a simple app, that showcases deployment with k8s. App is a simple markbook which uses React on frontend, express on backend to connect to PostgreSQL database, which uses presistant volumes. Next to the app we also spin up a multistage minimal build image of a golang server, that returns hello.
Blue green update will change the frontend of the aplication(mainly colors so that the change is obvious), rolling update will be done on the GO server where the "new" version will return a different a string.
Also has Gihthub actions to build and push docker images on pull/push.
Here you can see video showing everything.
video.mp4
Video (google drive if above doesnt work)
Run the commands:
minikube start
minikube addons enable ingress
minikube tunnel
git clone https://github.com/BlazBone/msi3
cd msi3
First we also need to generate secret (we dont want our pasword to be hardcoded) run
kubectl create secret generic pgpassword --from-literal PGPASSWORD=12345
this creates a secret with name pgpassword and key PGPASSWORD
kubectl apply -f k8s
This opens two different versions of clientside(light and dark), backend/api, database and also 3 pods of GO multistage build server(only first version) all images used are in my dockerhub but if some are missing or not working the Dockerfiles are there so you could build them.
we can see frontend of our application running if we visit http://localhost
. But it takes some time to strat running.
We can also visit http://localhost/api/now
that return a JSON response from our database, http://localhost/go_multi
that return string sent from our GO server.
They will allow us to keep track of updates taking place
Run:
kubectl get deployment go-ip -o wide --watch
We only want to see our go server here, since this is the one we will be having our rolling update done on.
kubectl get pods --watch
On the client side of the app we switch the image to the one having dark theme. Go server takes some time(it must be ready and alive) but eventially the 3 pods will change to the new version that outpust a slightly modified string.
To run both deployments use:
kubectl apply -f k8sv2
We can now visit http://localhost
to see the effect.
Also visiting and refreshing http://localhost/go_multi
will yield a different result. (Check when new pods are avalible on the terminals we set up in the 5th step)
- http://localhost
- we can enter the mark in 'vnesi oceno'(must be INT) end subject in 'vnesi predmet'
- press 'dodaj v predavalnico' to add to the markbook
- show our markbook with 'prikazi redovalnico'
- http://localhost/go_multi/
- http://localhost/go_multi/drugo short description (in slovene) about difference of images