Posts

Kubernetes – Creating Multiple Containers in a Pod

  Introduction Kubernetes is an open-source container orchestration platform developed by Google in 2014 and written in Golang . It automates container deployment, load balancing, scaling, and management across multiple environments — including physical, virtual, and cloud-based infrastructures. All major cloud providers (like AWS, Azure, and GCP) support Kubernetes as a managed service. Kubernetes ensures your containers run efficiently and reliably through its powerful automation and scheduling capabilities. Kubernetes Architecture Overview 1. Kube-API Server The API Server is the main entry point to the Kubernetes control plane. It directly interacts with users through YAML or JSON configuration files and processes requests to manage cluster resources. It acts as the frontend of the control plane . 2. ETCD etcd is a consistent, distributed key-value store that maintains the cluster state and metadata . It ensures high availability and reliability of data across n...

How to Run Shell Commands in Kubernetes Pods or Containers

 Kubernetes—commonly known as K8s —is an open-source container orchestration platform originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF) . It is designed to automate the deployment, scaling, and management of containerized applications, helping organizations achieve agility and consistency across environments. Running shell commands inside Kubernetes Pods or containers is a fundamental skill for developers and DevOps engineers managing applications in Kubernetes clusters. This guide will walk you through how to do it step-by-step, using Minikube for demonstration. Setting Up a Kubernetes Cluster Before executing shell commands, ensure that your Kubernetes cluster is properly set up. You can do this in one of two ways: Full Cluster Setup – A production-grade environment with multiple nodes. Single-Node Setup with Minikube – A lightweight local Kubernetes environment ideal for testing and development. The main differen...

Kubernetes – Node

Kubernetes Nodes are the actual worker or master machines where the real execution of workloads takes place. Each node runs essential services to operate Pods and is managed by the Kubernetes Control Plane. A single Kubernetes node can host multiple Pods, and each Pod can run one or more containers. There are three key processes that operate on every node to schedule and manage Pods: Container Runtime: The engine that runs containers inside Pods. Example: Docker, containerd, CRI-O. Kubelet: The agent responsible for communicating with the Control Plane and the container runtime. It ensures Pods are running as defined in the PodSpec. Kube-Proxy: Handles networking for Pods by forwarding requests from Kubernetes Services to the correct Pods on the node. What is Kubernetes? Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Originally developed by Google and now maintained by t...

Kubernetes Namespaces

 In Kubernetes , Namespaces provide a logical way to isolate and organize groups of resources within a single cluster. They are especially useful in environments where multiple teams or projects share the same cluster, allowing separation and management of resources independently. Each resource in a Namespace must have a unique name , but resources across different Namespaces can share the same name without conflict. Default Kubernetes Namespaces When you create a Kubernetes cluster, it comes with four built-in Namespaces : default kube-node-lease kube-public kube-system To view all available Namespaces, use: kubectl get namespaces You’ll see the four default Namespaces listed. Bonus: Kubernetes Dashboard Namespace (Minikube Specific) When you install Minikube , an additional Namespace called kubernetes-dashboard is automatically created. This Namespace is specific to Minikube and not present in standard Kubernetes clusters. 1. kube-system The kube-s...

Kubernetes Pods: How to Create and Manage Them

 A Pod represents a single instance of a running process in your Kubernetes cluster and can contain one or more containers. Think of a Pod as a lightweight, application-specific logical host . All containers within a Pod are co-located on the same worker node and share the same execution environment. This shared context is what makes Pods special, and it includes: Shared Networking Each Pod gets a unique IP address. All containers within that Pod share this IP and port space, allowing them to communicate with each other over localhost . Shared Storage Containers in a Pod can share storage volumes, providing a common filesystem for data exchange and persistence. The Pod Lifecycle A Pod progresses through several lifecycle phases: Pending: The Pod has been accepted by the Kubernetes system, but one or more container images have not yet been created. This could be due to image download delays or the scheduler finding a suitable node. Running: The Pod is bound to a nod...