Kubernetes - Components
Kubernetes is built from several core components that work together to run and manage containerized applications. These components are usually grouped into:
- Control Plane Components (manage the cluster)
- Node Components (run workloads)
1️ . Control Plane Components
The control plane is responsible for managing the Kubernetes cluster.
1. kube-apiserver
The API server is the entry point to the cluster.
Everything in Kubernetes goes through it.
Responsibilities
- Exposes the Kubernetes REST API
- Validates requests
- Processes CRUD operations for resources
- Communicates with the cluster datastore
Example operations:
- Creating a Pod
- Scaling deployments
- Updating configurations
Flow example:
User → kubectl → API Server → etcd
Key points:
- Stateless
- Can be horizontally scaled
- All components talk to it
2. etcd
etcd is the key-value database of Kubernetes.
It stores all cluster state.
Stores
Pods
Deployments
ConfigMaps
Secrets
Node info
Service definitions
Example:
/registry/pods/default/nginx-pod
Key features:
Distributed
Highly consistent
Uses Raft consensus algorithm
If etcd is lost → cluster state is lost.
3. kube-scheduler
The scheduler decides which node should run a pod.
When a Pod is created:
- API server receives request
- Pod has no node assigned
- Scheduler selects best node
Scheduling decisions based on
- CPU / Memory availability
- Node labels
- Taints and tolerations
- Affinity / Anti-affinity
- Resource requests
Example:
Pod → Scheduler → Node3 selected
Scheduler only assigns the node.
4. kube-controller-manager
Runs controllers that maintain cluster state.
Controllers constantly watch the cluster and make corrections if needed.
Example idea:
Desired state != Actual state
Controller fixes it
Major Controllers
Node Controller
- Detects node failures
Replication Controller
- Ensures correct number of pods
Deployment Controller
- Manages rolling updates
Job Controller
- Handles batch jobs
Example:
If 3 replicas required but only 2 running:
Controller creates new pod
5. cloud-controller-manager (optional)
Used when Kubernetes runs on cloud providers.
Manages cloud resources like:
- Load balancers
- Storage volumes
- Node lifecycle
- Routes
Examples of providers:
- AWS
- Azure
- GCP
2️⃣ Node Components
These run on every worker node and are responsible for running containers.
1. kubelet
The kubelet is the node agent.
It ensures containers are running as expected.
Responsibilities
- Communicates with API server
- Watches PodSpecs
- Starts containers via runtime
- Reports node status
Example workflow:
API Server → Pod assigned to node
↓
Kubelet reads PodSpec
↓
Starts container
2. Container Runtime
The container runtime runs containers.
Examples:
- containerd
- CRI-O
- Docker (older clusters)
Responsibilities:
- Pull images
- Start containers
- Stop containers
- Manage container lifecycle
Example:
Kubelet → containerd → start container
3. kube-proxy
kube-proxy manages networking rules for services.
It allows pods to communicate using Services.
Responsibilities
- Maintains iptables/IPVS rules
- Implements service load balancing
- Routes traffic to correct pods
Example:
Service IP → kube-proxy → Pod1 / Pod2 / Pod3
kube-proxy provides internal load balancing.
3️⃣ Additional Important Kubernetes Objects
These are not core binaries but are important resources.
Pod
Smallest deployable unit.
Contains:
- One or more containers
- Shared network
- Shared storage
Example:
Pod
├── Container A
└── Container B
Deployment
Manages stateless applications.
Features:
- Rolling updates
- Rollbacks
- Replica management
Example:
Deployment
↓
ReplicaSet
↓
Pods
Service
Provides stable networking for Pods.
Types:
ClusterIP
NodePort
LoadBalancer
Headless
Example:
Client → Service → Pods
ConfigMap
Stores configuration data.
Example:
- Environment variables
- Application configs
Secret
Stores sensitive data.
Examples:
- Passwords
- API keys
- TLS certificates
4️⃣ Kubernetes Architecture Overview
🧠Simple Way to Remember
|
Component |
Role |
|
API Server |
Entry point |
|
etcd |
Cluster database |
|
Scheduler |
Chooses node |
|
Controller Manager |
Maintains desired state |
|
kubelet |
Runs pods on node |
|
Container Runtime |
Runs containers |
|
kube-proxy |
Handles service networking |
✅
One-line summary
Kubernetes works by storing desired state in etcd, exposing it through the API server, scheduling pods with the scheduler, enforcing state with controllers, and running workloads through kubelet and container runtime.
Comments
Post a Comment