DevOps Classroom Series (Evg) – 12/Sept/2021

Daemon Sets

  • A Daemonset ensures a copy of Pod is running across set of nodes in k8s cluster
  • Daemon Sets are used to deploy system daemons such as log collectors and monitoring agents which typically must run on every node.
  • Refer Here for the changeset


  • A job is supervisor in k8s that can be used to manage pods to run some script/task and exit gracefully
  • The pods created by the job are not deleted following the completion of job, the pods run to completion and stay with completed status
  • To test this lets create an pod with alpine container which sleeps for 2m and restartPolicy OnFailure
  • Refer Here to the changeset containing dummy job Preview Preview
  • Exercise: Write a cron job spec which runs alpine pod for 2 minutes every hour (every 1/2 hour) using cron job spec

k8s on Cloud Platforms

  • Azure Supports k8s as service with a Service offering called as Azure Kubernetes Service (AKS)
  • AWS Supports k8s as service with a Service offering called as Elastic Kubernetes Services (EKS)
  • GCP Support k8s as Service with Service offering called as Google Kuberentes Engine (GKE)
  • The basic approach for any cloud based offering of k8s as Service is
    • The master node is by default highly available and is managed by cloud provider
    • We need not install k8s components on nodes cloud providers will take care of installations.
    • Every Cloud has its version of Networking component (CNI) implemented.

Azure Kubernetes Services

  • Launching AKS Refer Here
  • In this case we can install kubectl on your laptop/workstation
  • Azure CLI installed on local machine
  • Follow the steps mentioned in Launching AKS Preview

Problem with Storage

  • We have learned that container store the data in read/write layer which gets deleted when the conainer is deleted.
  • So in the case of docker we have used volumes
  • Now, In k8s also we need to look out for a solution as we are dealing with multiple nodes as well
  • Kubernetes has two major solutions
    • Volumes
    • Persistent Volumes

Kubernetes Volumes

  • Volumes are storage abstractions for Pod application Preview
  • Lifetime of K8s Volume is same as the Pod that uses.
  • Even if the containers in the pod restart the same volume will be used by containers and Data will not be lost, but when pod is deleted or terminate volume will also be deleted
  • Types of volumes
    • Empty Dir
    • hostPath
    • We also have other cloud based volumes Refer Here
  • Lets create a sample pod with empty dir volumes Refer Here Preview
  • Lets login into contianer and then look it mounts Preview
  • Lets create a host path Refer Here Preview

Persistent Volumes

  • K8s supports persistent storage in the form of Persistent Volumes (PV)

  • PV is k8s object that represents a block of storage in cluster which can be provisioned manually or we can dynamically provision

  • PV is a cluster resource. Lifecycle of PV doesnot depends on Pod but will be alive as long as cluster is. Preview

  • For official docs Refer Here

  • Refer Here for types of persistent volumes

  • Each Persistent Volume Belongs to a certain storage class

  • All the cloud based providers support different types of storage classes and they will have default storage classes as well

  • In the case of AKS Preview

  • Azure Disk

  • Azure Files:

  • Lets create a mysql volume for a mysql pod with Persistent Volume Claim (Dynamic provisioning) Refer Here Preview

Leave a Reply

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

About learningthoughtsadmin