This repository is intended to teach how to rollout changes a Docker HelloWorld image into the Kubernetes clusters.
If you are here just for fun or learning, you will need to machines, Just 4Fun
- kubectl client configured (In other words, you need to have a k8s cluster.)
- Helm installed (Helm initialized in the cluster)
PS: By default the app deployed version will be v1.0.0
- Installing:
$ cd hello-world-web-chart/
$ helm install --name hello-world-web .
- Check Installation:
http://<your ip address>:31000
- Change the file version:
vi app/index.html
- Building Image:
$ docker build -t hello-world-web:<VERSION> .
- Tagging the Image:
$ docker tag <IMAGE ID> <DOCKERHUB USER>/hello-world-web:<VERSION>
- Pushing to your repository:
$ docker push <DOCKERHUB USER>/hello-world-web:<VERSION>
- Testing Docker image:
$ docker run -d -p80:80 <DOCKERHUB USER>/hello-world-web:<VERSION>
- Now follow the steps bellow
PS: Before rolling out update login in another terminal of your cluster and run the command bellow:
$ while true; do curl 0:31000; sleep 1s;
- Change the configurations according to your container in values.yml:
$ cd hello-world-web-chart/
$ vi values.yml
- Edit Chart.yml with new versions of the application:
$ vi Chart.yml
- Upgrading the app:
$ helm upgrade hello-world-web .
- Check the version at the other terminal and the current terminal:
$ helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
hello-world-web 2 Fri May 24 16:55:54 2019 DEPLOYED hello-world-web-chart-2.0.0 2.0.0 default
- Check the revision number:
$ helm history hello-world-web
REVISION UPDATED STATUS CHART DESCRIPTION
1 Fri May 24 16:29:23 2019 SUPERSEDED hello-world-web-chart-1.0.0 Install complete
2 Fri May 24 16:55:54 2019 DEPLOYED hello-world-web-chart-2.0.0 Upgrade complete
- Use the revision number in the command bellow:
$ helm rollback hello-world-web <REVISION NUMBER>
helm del --purge hello-world-web
$ cd k8s-cluster/
$ vagrant up
$ vagrant ssh k8s-master
$ vagrant@k8s-master:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 18m v1.13.3
node-1 Ready <none> 12m v1.13.3
node-2 Ready <none> 6m22s v1.13.3