DevOps Classroom notes 16/Feb/2025

Managed Kubernetes

  • This is Kubernetes as a service offerings from cloud providers
  • The managed k8s removes the burden of managing control plane and administrative activities are either automated or simplfied.
  • Managed k8s is integrated with
    • cloud networks
    • cloud storages
  • Managed k8s gives us the SLA ( Service Level Agreement) in terms of uptime and availability
  • Popular Managed k8s
    • AKS (Azure Kubernetes Services)
    • EKS (Elastic Kubernetes Service)
    • GKE (Google K8s engine)
  • Ensure kubectl is installed on your system
  • How kubectl works?
    • kubectl needs a config file where the authentication information and server information are stored (~/.kube/config)

Azure AKS Creation

  • Easiest way to create AKS is using Azure CLI
  • Docs
  • Steps
# variables
export MY_RESOURCE_GROUP_NAME="myAKSResourceGroup"
export REGION="eastus"
export MY_AKS_CLUSTER_NAME="myAKSCluster"
export MY_DNS_LABEL="mydnslabel"

# creates a resource group
az group create \
    --name $MY_RESOURCE_GROUP_NAME \
    --location $REGION

# creates an aks cluster 
# note: this command i will be running on cloudshell as it generates ssh keys
az aks create \
    --resource-group $MY_RESOURCE_GROUP_NAME \
    --name $MY_AKS_CLUSTER_NAME \
    --node-count 2 \
    --generate-ssh-keys \
    --node-vm-size Standard_B2ms

# kubectl can be install with az aks install-cli

# to get the kubeconfig file
az aks get-credentials \
    --resource-group $MY_RESOURCE_GROUP_NAME \
    --name $MY_AKS_CLUSTER_NAME
  • check the connectivity
kubectl get nodes
  • To remove k8s cluster
# delete the resource group
az group delete \
    --name $MY_RESOURCE_GROUP_NAME \
    --yes \
    --no-wait

Preview

Lets create a service of type load balancer in aks

  • service of type lb and httpd rs
  • Refer Here for the changes done to add service of type lb
  • We have used a replicaset Refer Here
    Preview

Health Probes in K8s

  • official docs
  • Three types of Health Probes/checks
    • Starup Probe:
      • Why: This verifies if the contianer is started or not.
      • What it does: if this check fails the container will be restarted
    • Liveness
      • Why: If the application is live or not (liveness)
      • What is does: restarts on failure
    • Readiness:
      • Why: If the application is ready to serve traffic
      • What it does: This pod will not recieve traffic from service on failure
  • How to do the checks
    • exec: This check will run a command inside container and relies on exit code (0 => success all other numbers is failure)
    • tcp: This check will verify if the port is open for connection or not, Generally used for databases, cache servers
    • http: This check will send an http request to an endpoint and if it replies with 2xx or 3xx is considered as success
    • grpc: Here we can verify the grpc endpoint is responding

Lets change the spring petclinic replica set to have all the three probes

  • image: shaikkhajaibrahim/febspc:1
  • port: 8080
  • Refer Here for replicaset spec

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube