Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A Quiz
🔍 Introduction
Kubernetes is a powerful open-source system designed to automate
the deployment, scaling, and operation of containerized applications.
Understanding its architecture is essential for deploying and managing
applications effectively.
In this chapter, we’ll explore the core components that make
up a Kubernetes cluster, how they interact, and the roles they play in ensuring
high availability, scalability, and automation.
🧱 What is a Kubernetes
Cluster?
A Kubernetes cluster is a set of machines (virtual or
physical) that run containerized applications. It consists of:
🖥️ High-Level Cluster
View
text
+------------------------+
| Control
Plane |
|
|
| +--------------------+ |
| | API Server
| |
| | Scheduler
| |
| | Controller Manager | |
| | etcd
| |
| +--------------------+ |
+------------------------+
|
v
+-------------------+
+-------------------+
| Worker Node 1 |
| Worker Node 2 |
| +---------------+ |
| +---------------+ |
| | Kubelet |
| | | Kubelet | |
| | Kube Proxy |
| | | Kube Proxy | |
| | Container Runtime| |
| | Container Runtime| |
| +---------------+ |
| +---------------+ |
|
[Pods/Containers]
[Pods/Containers] |
+-------------------+
+-------------------+
📌 Key Kubernetes
Components
🔷 Control Plane
Components
These components maintain the cluster's desired state,
such as which applications are running and their configurations.
🧠 1. kube-apiserver (API
Server)
bash
kubectl
get pods
kubectl
create deployment myapp --image=nginx
📖 2. etcd (Cluster Store)
🗂️ 3. kube-scheduler
🛠️ 4.
kube-controller-manager
Runs controller loops that regulate cluster state:
Controller Type |
Role |
Node Controller |
Detects and replaces
failed nodes |
Replication Controller |
Ensures
desired Pod replica count |
Job Controller |
Handles batch job
lifecycle |
Endpoints Controller |
Populates
Service endpoints |
🌐 5.
cloud-controller-manager (Optional)
Used when running Kubernetes in a cloud environment
(GCP, AWS, Azure). It handles:
🔶 Node (Worker)
Components
Worker nodes run actual application workloads (your
containers).
🧩 1. kubelet
📦 2. Container Runtime
🔄 3. kube-proxy
⚙️ Kubernetes Objects: Managing
Cluster State
These are persistent entities in the Kubernetes system:
Object |
Purpose |
Pod |
Single instance of a
running container |
Service |
Exposes Pods
as a network service |
Deployment |
Manages replica sets
and rollout updates |
ReplicaSet |
Ensures
specified number of Pods run |
Namespace |
Logical division of
cluster resources |
📊 Control Plane vs.
Worker Nodes: Comparison Table
Feature |
Control Plane |
Worker Node |
Purpose |
Cluster management
& orchestration |
Run workloads (Pods) |
Key Components |
API Server,
etcd, Scheduler |
Kubelet,
Kube-proxy, Runtime |
Runs Application
Pods |
❌ No |
✅ Yes |
Stateful |
✅
Yes (stores cluster state) |
❌
No (stateless per node) |
🧰 Kubernetes API and
Declarative Config
Kubernetes works on a declarative model. You describe
your desired state using YAML or JSON, and the control plane tries to
match it.
Example Deployment YAML:
yaml
apiVersion:
apps/v1
kind:
Deployment
metadata:
name: webapp
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:1.17
ports:
- containerPort: 80
Apply it with:
bash
kubectl
apply -f deployment.yaml
🔄 How Kubernetes
Maintains Desired State
If a Pod crashes or a node fails, Kubernetes:
This self-healing mechanism makes Kubernetes
resilient and production-ready.
📦 Add-Ons and Optional
Components
Beyond core components, Kubernetes often includes:
Add-on |
Purpose |
Dashboard |
Web UI for managing
cluster |
Metrics Server |
Collects
CPU/memory metrics |
CoreDNS |
Internal DNS for Pods/Services |
Helm |
Kubernetes
package manager |
🌐 Cluster Networking
Overview
🔐 Security & Role
Management (Overview)
Security Concept |
Description |
RBAC |
Controls user access
to resources |
Namespaces |
Segregates
environments (dev, staging, prod) |
ServiceAccounts |
Secure access for Pods |
PodSecurityPolicies |
Define security
context for Pods |
🧪 Setting Up a Local
Kubernetes Cluster
🔹 Minikube
bash
minikube
start
kubectl
get nodes
🔹 Docker Desktop
Enable Kubernetes in Docker Desktop settings
(macOS/Windows).
🔹 Kind (Kubernetes in
Docker)
bash
kind
create cluster
kubectl
get nodes
✅ Summary: What You Learned in
Chapter 1
Answer: Docker is used to build and run containers,
while Kubernetes is a container orchestration platform that manages the
deployment, scaling, and operation of multiple containers across a cluster of
machines.
Answer: Yes, a basic understanding of Docker is
essential since Kubernetes is designed to manage and orchestrate Docker (or
OCI-compatible) containers. You'll need to know how to build and run container
images before deploying them with Kubernetes.
Answer: A Pod is the smallest deployable unit in
Kubernetes. It encapsulates one or more containers that share the same network,
storage, and lifecycle. Pods are used to run containerized applications.
Answer: You can expose your application using a Service
of type LoadBalancer or NodePort. For more advanced routing (e.g., domain-based
routing), you can use an Ingress Controller.
Answer: A Deployment is a Kubernetes object that
ensures a specified number of replicas (Pods) are running at all times. It
handles rolling updates, rollback, and maintaining the desired state of the
application.
Answer: Yes. Tools like Minikube, Kind,
and Docker Desktop (with Kubernetes enabled) allow you to run a local
Kubernetes cluster on your machine for development and testing.
Answer: Both are used to inject configuration data
into Pods. ConfigMaps store non-sensitive data like environment
variables, while Secrets are designed to store sensitive data like
passwords, API tokens, or keys—encrypted at rest.
Answer: Kubernetes automatically restarts failed
containers, replaces them, reschedules Pods to healthy nodes, and ensures the
desired state (like the number of replicas) is always maintained.
Answer: Kubernetes integrates well with monitoring
tools like Prometheus, Grafana, Kube-state-metrics, and ELK
stack (Elasticsearch, Logstash, Kibana). These tools help you track
performance, health, and logs.
Answer: While Kubernetes shines in large, scalable
environments, it can also be used for small projects—especially with tools like
Minikube or cloud-managed clusters. However, simpler alternatives like Docker
Compose may be better suited for truly small-scale applications.
Please log in to access this content. You will be redirected to the login page shortly.
LoginReady to take your education and career to the next level? Register today and join our growing community of learners and professionals.
Comments(0)