DevOps Classroomnotes 19/Feb/2022

Deployment Strategies

  • When it comes to changing the version of the software (i.e. your application), a K8s deployment supports two strategies
  • Recreate
  • RollingUpdate

Recreate Strategy

  • This strategy updates the replica set and terminates all of the Pods associated with deployment.
  • The ReplicaSet noticias that it no longer has any replicase and re-creates all the Pods using new Image.
  • Once the Pods are recreated, they are running the new version.
  • While this strategy is simple and fast, it has one major drawback, it leads to certain downtime of your application.

RollingUpdate Strategy

  • This strategy is generally preferable strategy for any user facing service.
  • While it is slower than Recreate, the Rolling Update can rollout a new version of your service while it serving usertraffic, without having any downtime.
  • Configure: There are two Parameters that can be used to tune the rolling update behavior
  • maxUnavailable:
    • this parameter sets the maximum number of Pods that can be unavailable during a rolling update
    • It can be either set to an absolute (2) or percent (25%)
  • maxSurge:
    • This parameter controls how many extra resources can be created to acheive a rollout.
    • It can be either set to an absolute (2) or percent (25%)
  • Refer Here for the yaml spec with maxSurge and maxUnavailable
  • Create a deployment
  • Create a Service
  • Lets create a new version and see how the deployment Refer Here

Waiting for 5 mins for deployment questions? 7:45 PM


  • I want to replicate Set of Pods where i want to have exactly one Pod on every Node in the cluster because this pod is my log agent
  • A Daemonset ensures a copy of Pod is running across a set of nodes in the k8s cluster.
  • As an example lets try to create a daemonset which runs an alpine container with sleep 1d
  • Refer Here for the changes done


  • While long-running processes make up the large majority of workloads that are run in k8s cluster, there is often a need for short-lived one-off tasks.
  • A K8S Job Object is made for handling these type of tasks
  • A job creates a pod that run until succesful termination.
  • A regular Pod will continually restart the container regardless of exit code.
  • Jobs are useful for things you only want to do once, such as database migrations or batch jobs etc.
  • Job Patterns
  • One Shot
  • Cron Jobs
  • Lets create a Job which runs the alpine pod and we make it sleep for 60seconds so that the Job is completed. Refer Here for api reference
  • Lets create a Job Spec Refer Here
  • In Some Case we would like to run the job on certain time interval. Lets create a cron job Refer Here
  • Next Steps:
  • Configuration objects in k8s
  • Health Checks
  • Storage
  • Services, Ingress
  • AKS, EKS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner