Kubernetes — Decoding DevOps [12]

Bhavyansh @ DiversePixel
4 min readJul 1, 2024


Kubernetes: Orchestrating Your Containerized World

As a DevOps professional, you’re likely familiar with the power of tools like Jenkins, Ansible, Docker, and AWS services. These tools empower you to automate tasks, manage infrastructure, and build containerized applications. But to truly harness the potential of containerized deployments, you need a powerful orchestrator, and that’s where Kubernetes shines.

Photo by Growtika on Unsplash

Kubernetes, often referred to as “K8s”, is a powerful open-source system for automating deployment, scaling, and managing containerized applications. Think of it as the “brain” behind your containerized ecosystem, ensuring your applications run smoothly, efficiently, and reliably across a cluster of machines.

Why Choose Kubernetes?

Kubernetes offers a myriad of benefits that make it the go-to platform for modern application deployments:

  • Orchestration: Kubernetes takes care of scheduling, deploying, and scaling your containers across multiple nodes. It handles resource allocation, load balancing, and health checks, freeing you to focus on your application logic.
  • High Availability: Kubernetes ensures that your applications remain up and running even if a node fails. It automatically restarts failed containers and redistributes workloads to healthy nodes.
  • Scalability: With Kubernetes, you can effortlessly scale your applications up or down based on demand. You can add or remove nodes to your cluster dynamically, ensuring your applications can handle varying workloads.
  • Self-Healing: Kubernetes automatically detects and recovers from failures. It restarts unhealthy containers, manages resource usage, and ensures your applications remain stable and resilient.
  • Service Discovery and Load Balancing: Kubernetes simplifies service discovery and load balancing. It provides a consistent way to access services regardless of their location within the cluster.
  • Automated Rollouts and Rollbacks: Kubernetes allows you to perform automated rollouts of new application versions, ensuring a smooth transition and minimizing downtime. It also enables rollbacks to previous versions if issues arise.
  • Security: Kubernetes provides robust security features, including role-based access control, network policies, and container security measures.

Kubernetes Architecture

Kubernetes operates on a master-worker architecture.

  • Master Node: This node acts as the control plane, managing the cluster’s state. It handles tasks like scheduling pods, monitoring cluster resources, and managing deployments.
  • Worker Nodes: These nodes run your containers. They receive instructions from the master node and execute them, running your applications.

Kubernetes is a complex system with several components that work together to provide its functionality:

  • API Server: The primary point of interaction for users and tools to manage cluster resources.
  • Scheduler: Responsible for deciding which node to place a pod.
  • Controller Manager: Manages core Kubernetes objects like pods, deployments, and services.
  • etcd: A distributed key-value store that stores the cluster’s configuration and state.
  • kubelet: The agent running on each worker node that communicates with the master node and manages containers.
  • kube-proxy: A network proxy that enables service discovery and load balancing.

Kubernetes Beyond the Basics

While Kubernetes provides a robust platform for container orchestration, its capabilities extend beyond basic deployment.

  • Add-ons: Kubernetes offers a range of add-ons that provide additional functionality, such as:
  • DNS: For name resolution within the cluster.
  • WebUI: A graphical interface for managing and monitoring the cluster.
  • Container Resource Monitoring: Provides insights into resource consumption for better optimization.
  • Cluster Level Logging: Centralizes logs from containers and services for easier analysis.
  • Pods: The fundamental unit of deployment in Kubernetes. A pod represents a single instance of your application running in a container.
  • Pods can have multiple containers for complex applications.
  • A single node can run multiple pods.

Setting Up Your Kubernetes Cluster

There are multiple ways to set up a Kubernetes cluster, each tailored to specific needs and environments:

  • Minikube: A single-node Kubernetes cluster for local development. It’s easy to set up and perfect for testing your applications locally.
  • K3s: A lightweight and fast Kubernetes distribution. It’s ideal for edge computing and small deployments with minimal resource requirements.
  • k0s: A “Kubernetes-as-a-service” platform that simplifies deployment and management. It’s highly suitable for production environments.
  • Kubernetes on AWS: Deploying a managed Kubernetes cluster in the cloud provides scalability, resilience, and ease of management.

Using Kubernetes with Kops

Kops is a tool for provisioning and managing Kubernetes clusters in AWS. It provides a streamlined way to set up and configure your clusters, eliminating manual configuration steps.

  1. Prerequisites: Ensure you have the following prerequisites:
  • Domain for K8s DNS records
  • Create a Linux VM and setup Kops.
  • SSH keys
  • AWS setup:
  • S3 buckets
  • IAM user for AWS CLI
  • Route53 hosted zone
  1. Minikube Setup:
  • kubectl create deployment hello-minikube — image=k8s.gcr.io/echoserver:1.0
  • kubectl create deployment hello-minikube — type=NodePort — port=8080
  • kubectl get service hello-minikube
  • minikube service hello-minikube
  1. Move to AWS:
  • kops — name=minikube — state=s3://kops-state-store
  • kops delete pod hello-minikube (delete deployment as well)
  • minikube stop
  • minikube delete
  • kops create cluster — name=kubapro-graphin — state=s3://bucket-name — zones=us-east-2a — node-count=2 — node-size=t3.small — master-size=t3.medium — dns-zone=mysubdomain.my.large — node-volume-size=8 — out-create-my-ip
  • kops update cluster — name — state=s3://
  • kops validate cluster — state=s3://

K8s Objects

Kubernetes uses a set of objects to manage your applications and resources:

  • Pod: Represents a single instance of your application running in a container.
  • Service: Provides a stable endpoint for accessing pods, hiding the underlying pod details.
  • ReplicaSet: Ensures that a specific number of pod replicas are always running.
  • Deployment: Defines the desired state of your application, managing pod replicas and rollouts.
  • ConfigMap: Stores configuration data for your applications.
  • Secret: Stores sensitive information like passwords and API keys.
  • Volume: Provides persistent storage for your applications.


Kubernetes has revolutionized the way we deploy and manage containerized applications. Its features, including automation, scalability, resilience, and security, make it an indispensable tool for DevOps professionals. As you delve into the world of Kubernetes, remember that it is a powerful and dynamic ecosystem. Explore its capabilities, experiment with different tools and strategies, and unleash the full potential of your containerized applications.



Bhavyansh @ DiversePixel

Hey I write about Tech. Join me as I share my tech learnings and insights. 🚀