Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zero Downtime Deployment with Kubernetes + HELM 📝

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

Prerequisites 🗺️

  • kubectl client configured (In other words, you need to have a k8s cluster.)
  • Helm installed (Helm initialized in the cluster)

Intalling App 📥

PS: By default the app deployed version will be v1.0.0

  1. Installing:
$ cd hello-world-web-chart/
$ helm install --name hello-world-web .
  1. Check Installation:
http://<your ip address>:31000

Creating Docker Image 🐳

  1. Change the file version:
vi app/index.html

  1. Building Image:
$ docker build -t hello-world-web:<VERSION> .
  1. Tagging the Image:
$ docker tag <IMAGE ID> <DOCKERHUB USER>/hello-world-web:<VERSION>
  1. Pushing to your repository:
$ docker push <DOCKERHUB USER>/hello-world-web:<VERSION>
  1. Testing Docker image:
$ docker run -d -p80:80 <DOCKERHUB USER>/hello-world-web:<VERSION>
  1. Now follow the steps bellow

ZeroDownTime Rollout ⏰

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;
  1. Change the configurations according to your container in values.yml:
$ cd hello-world-web-chart/
$ vi values.yml

  1. Edit Chart.yml with new versions of the application:
$ vi Chart.yml

  1. Upgrading the app:
$ helm upgrade hello-world-web .
  1. 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

Helm Rollback ⏪

  1. 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
  1. Use the revision number in the command bellow:
$ helm rollback hello-world-web <REVISION NUMBER>

Deleting ❌

helm del --purge hello-world-web

Just 4Fun 👾 🎮 🎲

Prerequisites 🗺️

$ 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages