Kubernetes rolling update using helm

kuberneteskubernetes-helmminikube

I am new to Helm. I have installed Minikube & Helm on my windows system. I am able create pods using Helm and see deployment,pods & replicaset in dashboard.

I want to do rolling update using Helm. Guide me how to do rolling update in K8s using Helm.

Creating Tomcat pod using Helm

helm create hello-world

Changed image name and deployment name in deployment.yaml

kind: Deployment
metadata:
  name: mytomcat
spec:
      containers:
        - name: {{ .Chart.Name }}
          image: tomcat

Install

helm install hello-world

NAME:   whopping-dolphin
LAST DEPLOYED: Wed Aug 30 21:38:42 2017
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Service
NAME                          CLUSTER-IP  EXTERNAL-IP  PORT(S)  AGE
whopping-dolphin-hello-world  10.0.0.178  <none>       80/TCP   0s

==> v1beta1/Deployment
NAME      DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
mytomcat  1        1        1           0          0s


NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app=hello-world,release=whopping-dolphin" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl port-forward $POD_NAME 8080:80

I see mytomcat deployment and pod mytomcat-2768693561-hd2hd in dashboard.

Now I would like to give command which will delete my current deployment & pod in k8s and it should create new deployment and pod.

It will be helpful if I get sample commands and yaml.

Best Answer

Below command is working fine for Rolling update.

  1. First time it will be install
  2. next time it will be upgrade

helm upgrade --install tom-release --set appName=mytomcatcon hello-world

tom-release is my release name and passing runtime values to helm chart using --set option

Related Topic