Please enable JavaScript.
Coggle requires JavaScript to display documents.
Kubernetes Full Course (TechWorld with Nana) - Coggle Diagram
Kubernetes Full Course (TechWorld with Nana)
1. What is Kubernetes?
Container Orchestration Tool
Manages containerized applications
Automates deployment, scaling, and operations
Why K8s?
Trend: Microservices + Containers
Manual management doesn't scale
K8s solves: high availability, scalability, disaster recovery
Benefits
High Availability → no downtime
Scalability → fast load response
Disaster Recovery → backup & restore
Core K8s Components
Pod
Smallest deployable unit
Abstraction layer over containers
Usually 1 application per Pod
Each Pod gets its own IP address
Pods are ephemeral → die and get replaced
Service
Permanent IP address for a set of Pods
Load balances between Pod replicas
Lifecycle independent from Pods
Types
ClusterIP (internal)
NodePort (external via node port)
LoadBalancer (external via cloud LB)
Ingress
Routes external HTTP/HTTPS traffic into cluster
Domain-based routing (e.g. myapp.com)
More elegant than NodePort or LoadBalancer
ConfigMap
External configuration for apps
Stores non-sensitive config data (URLs, env vars)
Connected to Pod → no need to rebuild images
Secret
Like ConfigMap but for sensitive data
Passwords, tokens, keys
Stored in base64 encoded format
Used as env vars or mounted as volumes
Volume
Attaches physical or cloud storage to a Pod
Ensures data persistence
Local or remote (NFS, cloud) storage
Deployment
Blueprint for Pods (stateless apps)
Defines desired replica count
Abstracts Pod creation and replication
Enables zero-downtime rolling updates
StatefulSet
For stateful apps (e.g. databases)
Manages Pod ordering and identity
Ensures safe reads/writes to shared storage
Often DBs are hosted outside K8s
Minikube & Local Setup
Minikube
Local single-node K8s cluster
Master + Worker processes on one machine
Runs in a VM or container (Docker)
Used for local testing
kubectl
CLI to manage any K8s cluster
Works with Minikube or cloud clusters
Install
Install minikube
Install kubectl
Start: minikube start --driver=docker
Useful commands
minikube start / stop / status
kubectl get nodes
kubectl get pods
kubectl get services
kubectl create deployment
kubectl apply -f <file.yaml>
kubectl describe pod <name>
kubectl logs <pod-name>
kubectl exec -it <pod> -- /bin/bash
kubectl delete deployment <name>
Namespaces
What is a Namespace?
Virtual cluster inside K8s cluster
Organizes resources into groups
4 Default Namespaces
kube-system → system processes
kube-public → publicly accessible data
kube-node-lease → node heartbeat info
default → where user resources go by default
When to use custom Namespaces?
Multiple teams / environments
Blue/Green deployments
Resource limits per team
Rules
Services in namespace A can't directly reference resources in namespace B (without DNS)
Some resources are cluster-scoped (e.g. Nodes, PersistentVolumes)
Commands
kubectl get namespaces
kubectl apply -f file.yaml --namespace=<ns>
Can set namespace in metadata of YAML
Helm
What is Helm?
Package manager for Kubernetes
"apt/brew for K8s"
Helm Charts
Bundle of YAML templates
Pre-configured K8s resources
Reusable across environments
Use Cases
Deploy complex apps with 1 command
Share configs via Helm Hub / Artifact Hub
Templating Engine
Define a blueprint YAML
Use {{ .Values.xxx }} placeholders
Override values via values.yaml or --set
Helm 3 vs Helm 2
Helm 3: no Tiller (server component removed)
More secure and simpler
Commands
helm install <chart>
helm upgrade <chart>
helm rollback
helm uninstall
StatefulSet
For stateful apps like databases
Vs Deployment
Pods have stable, unique identities (pod-0, pod-1…)
Ordered creation and deletion
Each Pod has its own PVC/storage
Use case: MySQL, MongoDB, Elasticsearch clusters
Recommendation: DBs outside K8s for simplicity
kubectl Commands Cheat Sheet
Cluster Info
kubectl cluster-info
kubectl get nodes
Pods
kubectl get pods -o wide
kubectl describe pod <name>
kubectl logs <pod-name>
kubectl exec -it <pod> -- bash
Deployments
kubectl get deployments
kubectl scale deployment <name> --replicas=3
Apply / Delete
kubectl apply -f file.yaml
kubectl delete -f file.yaml
Debugging
kubectl get events
kubectl top nodes / pods
K8s Architecture
Master Node
API Server
Entry point to the cluster
UI, API, CLI all go through here
Controller Manager
Tracks cluster state
Detects and corrects cluster issues
Scheduler
Decides which Worker Node gets a Pod
Based on resource availability
etcd
Key-value store
Stores cluster state & config data
Used for backups and restores
Worker Nodes
Each has a kubelet process
Communicates with API Server
Runs and manages Pods on the node
Each has a container runtime
e.g. Docker, containerd
kube-proxy
Forwards requests between Services and Pods
Maintains network rules
Virtual Network
Spans all nodes
Creates one unified machine
Enables Pod-to-Pod communication
K8s Configuration
kubectl (CLI tool)
Main way to interact with cluster
Communicates with API Server
Config file format: YAML
Every config file has 3 parts
metadata → name, labels
spec → desired state
status (auto-generated) → current state
Labels & Selectors
Labels: key-value pairs on resources
Selectors: used to match/connect resources
e.g. Service selects Pods by label
Demo Project: MongoDB + MongoExpress
Goal: Deploy MongoDB with MongoExpress UI
Components used
2 Deployments (MongoDB, MongoExpress)
2 Services (ClusterIP for DB, LoadBalancer for UI)
1 Secret (DB credentials)
1 ConfigMap (DB URL for MongoExpress)
Flow
Secret → MongoDB Deployment (env vars)
ConfigMap → MongoExpress Deployment (env vars)
MongoDB Service (ClusterIP) → internal access
MongoExpress Service (LoadBalancer) → external browser access
Lesson: Order of creation matters
Secrets & ConfigMaps must exist before Deployment
Ingress
What is Ingress?
Routes external traffic to internal Services
Handles host/path-based routing
Supports TLS/HTTPS termination
Ingress Controller
Pod that evaluates all Ingress rules
Manages routing
Examples: Nginx Ingress Controller, Traefik
Ingress YAML
spec.rules → host + path → service + port
TLS
Requires Secret with tls.crt and tls.key
Spec: tls.hosts + tls.secretName
Multiple paths / Multiple hosts supported
Volumes & Persistence
Problem: Containers are stateless
Data is lost when Pod restarts
K8s Storage Solutions
Persistent Volume (PV)
Cluster-wide storage resource
Created by Admin
Abstract actual storage (cloud, NFS, local)
Persistent Volume Claim (PVC)
Request for storage by a user/app
Binds to a matching PV
Referenced in Pod spec
Storage Class (SC)
Dynamic provisioning of PVs
Created automatically when PVC is bound
Provider-specific (AWS EBS, GCE PD, etc.)
Access Modes
ReadWriteOnce
ReadOnlyMany
ReadWriteMany
K8s Services (Deep Dive)
ClusterIP
Default type
Internal-only access
Stable IP + DNS within cluster
Headless Service
clusterIP: None
Returns Pod IPs directly
Used with StatefulSets
NodePort
Opens static port on each Node
Accessible from outside: NodeIP:NodePort
Range: 30000–32767
LoadBalancer
Extends NodePort
Provisions external cloud load balancer
Typically used in cloud environments