Rolling updates and update strategy in Kubernetes daemonsets
Daemonset ensures that all the nodes run a copy of a pod. It can be used for running storage/monitoring daemons like glusterd,Prometheus etc. Now in this post we are going to see how to create a daemonset and do an image update. We are also going to perform different update strategy and watch the behaviour of damonset updates.
Setup
I am using the Virtualbox(running in Ubuntu 18.04 physical machine) for this entire setup . The physical machine is Dell inspiron laptop with 12GB RAM , Intel® Core™ i7-6500U CPU @ 2.50GHz × 4 and 512GB SSD hardisk.
Step 1: Create a daemon set
Step 2: Verify the image version and updateStrategy of the daemonset
The daemonset has a image version of “ 2.5.2” and updateStrategy “ RollingUpdate”
Step 3: Update the daemon set container image to a different version say “2.5.2”
step 4 : Verify the image version is updated in daemonset level also in pod level
Now we can see , as soon as the daemonset image is updated , the pod image also gets updated. This is because of the updateStrategy set as RollingUpdate
Step 5: Now lets change the updateStrategy to OnDelete and watch the behaviour
The udpate strategy is changed to OnDelete and the version in 2.5.2
Step 6: Lets change the image to different version
Step 7: Verify the image version in daemonset and pod
Now we can see the image version on Daemonset is updated , but the pod is still running in the older version
Step 8: Lets delete the pod and wait for the new pods to be created and verify the image version in new pod
Now we can see the version is automatically updated on the new pod only after delete.
Discussion and feedback