DevOps Classroom Series – 18/Jul/2020 (Evening)

Challenges involved in K8s

  • Resource Configuration Challenge:
    • Many typed of k8s resources:
      • Deployment
      • Pods
      • ReplicaSets
      • Service
      • Ingress
      • StorageClass
      • PersistentVolumeClaims
      • Secret
      • ConfigMap
      • And many more
    • Deploying an application on k8s is not simple, you need have understanding of all resource types
  • Keeping the live and local states in sync:
    • K8s specifications will be created as yaml files stored in vcs like git
    • Whenever there are new changes we need to update git and pull those changes on server (local) and apply using kubectl (live).
    • But do you think this happens all the time?
    • In most of cases, we make local changes in the git apply it k8s (apply live state) and then commit changes to git (applying local states)
  • Application life cycles are hard to manage
  • Resource files are static
    • Even if the specifications are almost the same, since there is no parametrization, we need have multiple specs without reusability Preview

Helm Comes to the rescue.

  • To overcome challanges prompted a creation of simple but powerfull tool to deploy applications on k8s & that tool is helm
  • Helm is often referred to as the Kubernetes Package Manager

Understanding package managers

  • Package managers simplify process of installing, upgrading, reverting and removing system applications
  • Applications are defined in units, these units are called as packages. Packages contain metadata around target software & its dependencies
  • Lets take an example of you trying to install a software called as git
    • You will find the package name for git
    • Then you execute the command to install the package
    choco install git -y
    apt install git -y
    dnf install git --assumeyes # Fedora
    yum install git -y
    • Lets assume a new version of git is release
    choco upgrade git -y
    dnf upgrade git --assumeyes
    • if the new version is faulty, we can revert back to old version
    dnf downgrade git --assumeyes
    • If we want to remove software, we can execute
    dnf remove git --assumeyes
  • Who ever is creating package will have specific implementation details
    • dnf operates on RPM package
    • apt operates on deb packages
    • choco operates on nuget package
  • Once they create packages, they add metadata like version number etc and then they push the packages to some repository.
  • User will fetch these packages from repository and install application software.

K8s package manager

  • Helm works with charts. Charts are similar to packages.

  • Helm chart can be thought as K8s package.

  • Helm chart consists of

    • K8s resource files to deploy
    • some metadata
    • templates
  • To learn helm lets create AKS and EKS cluster

EKS Cluster

  • Installation Steps:

    • Creating AWS Ec2 instace,
    • Install AWS CLI
    • Install EKSCTL cli
    • Install kubectl
    • Use EKSCTL command to create cluster
  • Follow the instructions to create cluster from here

  • Also create AKS cluster if you have azure account credentials

Quick review of Helm

  • Refer here for official docs
  • Helm will have client component(helm-client) which generally runs along with kubectl and it also has server component (Tiller) which run in K8s cluster.
  • Once we install helm, helm use kubectl config file to communicate with k8s cluster. Preview
  • Lets understand subcommands of helm Preview
  • Installing and configuring helm on the linux instance where kubectl is configured
curl -fsSL -o
chmod 700

helm help
helm version

  • Lets add a repository to helm
helm repo add stable
  • Lets install an example chart
helm repo update
helm repo add stable
helm search repo stable
helm version
helm repo update
helm search repo stable | grep mysql
helm install stable/mysql --generate-name


  • clean up Preview

Lets do one more helm chart installation for redis

  • Lets use redis, lets use repositories from bitnami
helm repo add bitnami
helm install redis bitnami/redis --namespace=redis
kubectl get all -n redis

Preview Preview

  • If we get a new version of redis
helm upgrade redis bitnami/redis --namespace=redis
  • If we want to rollback to previous version
helm rollback redis 1 --namespace=redis
  • If we want to uninstall redis
helm uninstall redis --namespace=redis

How about creating charts?

  • Lets create a helm chart
helm create learning
  • When we create a helm chart a folder is created and in this folder there will subfolders and files Preview

  • Lets understand files/directory and their purpose

    • Chart.yaml: A file that consists of metatada about Helm chart. This is required
    • templates/: A directory that consists of k8s resources in YAML format.
    • templates/NOTES.txt: A file that can be generated to provided installation instructions during chart installation.
    • values.yaml: This file consists of charts default vaule.
    • .helmignore: ignore list (files/directoies) in the Helm chart package
    • charts/: A directory that consists of charts that this Helm chart is dependend on
    • Chart.lock: A file used to save previously applied dependecy version
    • This is documentation
    • LICENSE:
    • values.schema.json: A file contain the chars values schema in json format
  • Lets look at the deployment.yaml in the templates folder Preview

  • Helm use Go templating Refer Here

  • Go template control structures process begins with two opening curly braces and ends with two ending curly braces "{{ }}"

  • "{{ }}" will pull the values from Values.yml or _helpers.tpl (*.tpl)

  • Lets try to add dependencies to our chart

  • Make the necessary changes and execute Preview Preview

  • Now execute show values for dependency redis

helm show values chart/redis-10.7.11.tgz


  • Lets install our chart
kubectl create namespace lnspace
helm install my-learning learning -n lnspace

Preview Preview Preview

Leave a Reply

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

About learningthoughtsadmin