DevOps Classroomnotes 19/Feb/2022

Enterprise Kubernetes Setup

  • When we setup k8s for the enterprises/production environments, we would go with Highly available master nodes and then we would also create nodes
  • Now we would setup the kubernetes cluster and add the nodes into the cluster
  • The kubectl would be configured to run from workstations (laptops/desktops) from which deployments of applications are likely to happen.
  • In CI/CD Workflow, The jenkins node or azure devops agent will be the machine where kubectl is configured. From this node we will execute the kubectl apply commands on the manifests for deploying applications.

Kubernetes as a Service

  • When we try to use Kubernetes as a Service => (AKS, EKS, GKE)
  • Master nodes will be managed by the Service Provider (AWS, Azure, GCP)
  • Kuberentes installations will be done by the Service Provider
  • We just need to Specify the number of nodes and kubernetes version
  • Service providers also offer upgrade of k8s from one version to other without downtime
  • So our responsibility would be to
  • Create a k8s cluster just by specifying version and number of nodes
  • Configure kubectl on the nodes from where you are expected to deploy k8s manifests.
  • When we use Kubernetes as a Service, The cloud providers already have loadbalancer, The Services which we create, now can be exposed to the external world using cloud load balancer
  • In Docker/Kuberenets we need to deal with Storage i.e. in Docker we have create volumes. When we use kubernetes as a Service, Cloud Service Providers make it extreemly simple for us to create Storage solutions as they already have solutions for creating
  • virtual disks for Virtual Machines
  • virtual file Share (NFS) to share storage across VMs.

Lab: Kuberenets Cluster

  • For this and next session, we would be using kubernetes as a service (AKS).
  • I will be creating a k8s cluster in Azure
  • To create a k8s cluster Refer Here
  • Lets create a resource group and continue with docs
az group create --name myResourceGroup --location eastus

* Now lets create a k8s cluster with 2 nodes Refer Here

az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 2 --enable-addons monitoring --generate-ssh-keys

* Connect to the cluster Refer Here
* We need kubelet and we need the configuration of kubelet

az aks install-cli  # will install kubectl
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
  • To configure this on your local system, install azure cli
  • Windows Refer Here
  • Mac Refer Here
  • Linux Refer Here
  • After installation execute az login and connect to Azure account and execute
az aks install-cli  # will install kubectl
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster


  • So far we know how to package our application as container and create a replicaset of Pods running our container.
  • When we deploy some application on k8s and there is no next release of this application, then using replicaset is the best option.
  • But, we will have new releases to the application every day, every week etc… We need to have an option to deploy the new version of the application without having an impact on the customer/users
  • In k8s we have Deployment object exists to manage the release of new versions.
  • Deployments enables us to easily move from one version to another => rollout
  • Deployments can roll out a new version without down time and if the new version is not performing as expected, we can roll back (undo rollout) to the older version
  • Deployments manage replica sets, which in turn manages the Pods and replicas
  • Lets create a deployment of a sample application
  • As our k8s cluster has version 1.21 lets use that api reference Refer Here
  • Lets create a deployment and deploy Refer Here for the changes
  • Now lets create a service
  • More info about our deployment
  • Now lets simulate a new release i.e shaikkhajaibrahim/testapp:1.0.1 and apply the new spec Refer Here
  • Now lookout for the new version rollout
  • Now lets look at rollout history
  • Now lets try to roll back to the previous revision i.e. 2

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner