Understanding Kubernetes Components and Pod Creation

A comprehensive guide to Kubernetes architecture and its core components

Featured image



🎯 Overview

Let’s explore Kubernetes components and understand how pods are created within a cluster.

💡 Why Kubernetes?

Kubernetes offers several key benefits:



🏗️ Kubernetes Components

Control Plane Components

1. kube-apiserver
   - Central control point
   - Provides Kubernetes API
   - Handles Pod creation requests

2. etcd
   - Backup storage for cluster data
   - Maintains cluster state
   - Stores configuration and status

3. kube-scheduler
   - Watches for new Pods
   - Assigns Pods to nodes
   - Considers resource requirements

4. kube-controller-manager
   - Runs controller processes
   - Maintains desired state
   - Handles routine tasks

Node Components

1. kubelet
   - Ensures container operation
   - Manages Pod lifecycle
   - Communicates with control plane

2. kube-proxy
   - Manages network rules
   - Enables Pod communication
   - Maintains network policies

3. Container Runtime
   - Runs containers
   - Supports various runtimes
   - Manages container lifecycle



🔄 Pod Creation Process

User initiates deployment

kubectl apply -f k8s-deployment.yml

Process Flow

sequenceDiagram participant Client participant API_Server as API Server participant etcd participant Controller_Manager as Controller Manager participant Scheduler participant Kubelet participant Container_Runtime as Container Runtime Interface Client->>API_Server: 1. Create Pod API_Server->>etcd: 2. Store object definition etcd-->>API_Server: (Acknowledge) API_Server->>etcd: 3. Create POD resources & update etcd etcd-->>API_Server: (Acknowledge) API_Server->>Controller_Manager: 4. Identify where POD has to be created & update the state in etcd Controller_Manager-->>API_Server: (Acknowledge) Controller_Manager->>Scheduler: 5. Retrieve the template for the POD Scheduler->>Kubelet: 6. Create the container Kubelet->>Container_Runtime: (Container Created) Controller_Manager->>etcd: 7. Update the state


📌 Explanation of the Mermaid Diagram

  1. Client → API Server: Initiates the Pod creation request.
  2. API Server → etcd: Stores the object definition.
  3. API Server → etcd: Updates etcd with POD resource information.
  4. API Server → Controller Manager: Determines where to create the Pod and updates the state.
  5. Controller Manager → Scheduler: Scheduler retrieves the template for Pod scheduling.
  6. Scheduler → Kubelet → Container Runtime: Kubelet commands the Container Runtime to create the container.
  7. Controller Manager → etcd: Updates the final state in etcd.

This flow closely mirrors the Kubernetes pod creation lifecycle.



📚 Reference