How to Learn Kubernetes as a New Student
1. Clear Definition
How to Learn Kubernetes as a New Student: Kubernetes is a platform for running containerized applications across a cluster using declarative configuration and automation.
2. Explanation for New People
If you are new, Kubernetes feels large because it has many terms. Do not learn the words separately. Learn one story: you have an application image, Kubernetes runs it in Pods, Deployments keep Pods alive, Services give stable networking, Ingress exposes HTTP traffic, ConfigMaps and Secrets provide configuration, PVCs provide storage, and RBAC controls permissions.
3. Detailed Study Explanation
The most important Kubernetes idea is desired state. You describe what you want in YAML, and Kubernetes controllers continuously try to make the real cluster match that desired state. This is different from manually logging into a server and starting containers. You submit a manifest, the API server stores it, controllers watch it, scheduler places Pods, kubelet starts containers, and status/events show what happened. Study Kubernetes one layer at a time: architecture, kubectl, objects, workloads, networking, configuration, storage, reliability, security, packaging, observability, and projects.
4. Business Use Case
Companies use Kubernetes because manual container operations do not scale. A business may have many APIs, frontends, workers, and scheduled jobs. Kubernetes standardizes deployment, scaling, recovery, networking, security, and operations across teams.
5. Mental Model / Diagram
Image -> Pod -> Deployment -> Service -> Ingress
ConfigMap/Secret -> Pod configuration
PVC/StorageClass -> persistent storage
RBAC/NetworkPolicy/Pod Security -> security
Logs/Events/Metrics -> operations6. YAML / Commands / Configuration
kubectl version --client
kubectl cluster-info
kubectl get nodes
kubectl get pods -A
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| kubectl | CLI used to communicate with Kubernetes API server. |
| cluster-info | Shows cluster endpoint information. |
| get nodes | Lists nodes in the cluster. |
| get pods -A | Lists Pods across all namespaces. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Why Kubernetes Exists
1. Clear Definition
Why Kubernetes Exists: Kubernetes automates deployment, scaling, networking, recovery, and management of containerized workloads.
2. Explanation for New People
Docker can run containers, but a company with hundreds of containers needs orchestration. Orchestration means deciding where workloads run, replacing failed Pods, scaling replicas, connecting services, and rolling out new versions safely.
3. Detailed Study Explanation
Kubernetes is a control system. You say, for example, run 3 replicas of this API image, expose them using a Service, only send traffic to ready Pods, and restart unhealthy containers. Kubernetes keeps watching the cluster and reacts when actual state differs from desired state. If a Pod dies, a controller creates a replacement. If you scale to 5 replicas, the scheduler places new Pods on nodes. If a rollout fails, you can inspect events, logs, and rollout status.
4. Business Use Case
An e-commerce platform gets heavy traffic during sale days. Kubernetes can scale services, replace failed Pods, and perform rolling updates with less manual intervention.
5. Mental Model / Diagram
Manual world: admin starts containers and fixes failures.
Kubernetes world: YAML declares desired state, controllers repair differences, scheduler places Pods, kubelet runs containers.6. YAML / Commands / Configuration
kubectl create deployment web --image=nginx --replicas=3
kubectl get pods
kubectl scale deployment web --replicas=5
kubectl delete deployment web
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| create deployment | Creates desired state for a Deployment. |
| --replicas=3 | Asks Kubernetes to keep 3 Pods running. |
| scale | Changes desired replica count. |
| delete deployment | Removes the Deployment and its managed Pods. |
8. Common Mistakes
- Thinking Kubernetes is needed for every tiny script.
- Trying Kubernetes before understanding containers.
- Treating Pods like permanent servers.
- Changing running containers manually instead of updating manifests.
9. Troubleshooting Steps
- If Pods do not appear, describe the Deployment and read events.
- If Pods are Pending, check scheduler events and node resources.
- If image pull fails, check image name and registry access.
10. Student Practice
- Create nginx Deployment with 3 replicas.
- Delete one Pod and watch it come back.
- Scale replicas from 3 to 5.
- Explain desired state in your notebook.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Kubernetes vs Docker vs Docker Compose
1. Clear Definition
Kubernetes vs Docker vs Docker Compose: Docker builds and runs containers, Compose runs multi-container apps in a simple local stack, and Kubernetes orchestrates workloads across a cluster.
2. Explanation for New People
Docker is the packaging and container runtime learning foundation. Compose is useful for local app plus database development. Kubernetes is for cluster orchestration, scaling, recovery, security, and production-style operations.
3. Detailed Study Explanation
A good learning order is Docker first, Docker Compose second, Kubernetes third. Kubernetes uses container images, so image and container knowledge still matters. A real team may use Docker to build an image, Compose to run local API plus database, CI to push the image to a registry, and Kubernetes to run it in dev, QA, and production clusters. Kubernetes has more objects because it solves more operational problems than docker run or Compose.
4. Business Use Case
A SaaS company uses Compose locally, builds images in CI, pushes them to a registry, and deploys those images to Kubernetes in production.
5. Mental Model / Diagram
Docker: build image and run one container
Compose: run app + db + redis locally
Kubernetes: run many workloads across cluster nodes with controllers, Services, storage, and security6. YAML / Commands / Configuration
docker build -t myapp:dev .
docker compose up -d
kubectl create deployment myapp --image=myrepo/myapp:1.0.0
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| docker build | Builds image. |
| docker compose up | Runs local multi-service stack. |
| kubectl create deployment | Runs an image as a Kubernetes workload. |
8. Common Mistakes
- Confusing Compose YAML with Kubernetes YAML.
- Skipping Docker basics.
- Using Kubernetes when Compose is enough for a tiny local demo.
- Ignoring registry flow between Docker and Kubernetes.
9. Troubleshooting Steps
- If Kubernetes cannot pull image, check the image exists in a registry.
- If Compose works but Kubernetes fails, compare env, network, storage, and ports.
- If app binds localhost only, fix the app bind address before deploying.
10. Student Practice
- Explain Docker, Compose, and Kubernetes in one sentence each.
- Draw local dev to production flow.
- Build an image and reference it from a Kubernetes Deployment.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Cluster Architecture
1. Clear Definition
Cluster Architecture: A Kubernetes cluster contains a control plane and worker nodes; the control plane manages state and nodes run Pods.
2. Explanation for New People
A cluster is not one server. The control plane is the brain; worker nodes run your applications.
3. Detailed Study Explanation
The control plane exposes the API, stores state, schedules Pods, and runs controllers. Worker nodes run kubelet, kube-proxy, runtime, and Pods. Troubleshooting often means knowing which layer failed: API access, scheduling, node readiness, runtime, or networking.
4. Business Use Case
A platform team can run many business services on one standardized cluster instead of manually operating each server.
5. Mental Model / Diagram
Control Plane: API server, etcd, scheduler, controllers
Worker Node: kubelet, kube-proxy, runtime, Pods6. YAML / Commands / Configuration
kubectl cluster-info
kubectl get nodes -o wide
kubectl get pods -A
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| cluster-info | Shows control plane endpoint information. |
| get nodes -o wide | Lists nodes with details. |
| get pods -A | Shows workloads across namespaces. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Control Plane Components
1. Clear Definition
Control Plane Components: The control plane exposes the API, stores cluster state, schedules Pods, and reconciles desired state.
2. Explanation for New People
The control plane is like a management office. It does not run every app directly, but it accepts requests and coordinates everything.
3. Detailed Study Explanation
API server is the front door. etcd stores state. Scheduler chooses nodes. Controller manager runs reconciliation loops. Cloud controller integrates with cloud provider resources. Managed Kubernetes hides some operations, but the concepts still matter.
4. Business Use Case
Cloud teams need to know control plane concepts to troubleshoot scheduling, load balancer creation, RBAC, and rollout behavior.
5. Mental Model / Diagram
kubectl -> API server -> etcd stores desired state
Scheduler assigns Pods
Controllers repair actual state6. YAML / Commands / Configuration
kubectl api-resources
kubectl get events -A --sort-by=.lastTimestamp
kubectl describe deployment <name>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| api-resources | Lists API resource types. |
| events | Shows cluster activity/failures. |
| describe | Shows object details and events. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
API Server
1. Clear Definition
API Server: The API server is the front door of Kubernetes and validates, authorizes, admits, and stores requests.
2. Explanation for New People
kubectl talks to the API server, not directly to nodes.
3. Detailed Study Explanation
Every Kubernetes object change goes through the API server. Authentication, authorization, schema validation, and admission happen there. Controllers, scheduler, and kubelets watch the API server. If kubectl says forbidden, invalid, or connection refused, think API path.
4. Business Use Case
Companies enforce RBAC and admission policies through the API server so unsafe or unauthorized changes are blocked.
5. Mental Model / Diagram
kubectl apply -> API server -> auth -> validation -> admission -> etcd -> controllers act6. YAML / Commands / Configuration
kubectl auth can-i create pods
kubectl api-resources
kubectl explain pod.spec.containers
kubectl apply --dry-run=server -f app.yaml
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| auth can-i | Checks permission. |
| explain | Shows schema help. |
| dry-run=server | Validates through API server without saving. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
etcd
1. Clear Definition
etcd: etcd is the consistent key-value store Kubernetes uses to store cluster state.
2. Explanation for New People
Kubernetes needs memory of what exists. etcd stores that cluster state.
3. Detailed Study Explanation
The API server normally talks to etcd; users do not edit etcd directly. In self-managed clusters, etcd backup and restore are critical. Secrets may be stored in etcd, so encryption at rest and access control matter.
4. Business Use Case
A platform team with self-managed clusters must back up etcd to recover cluster state after disaster.
5. Mental Model / Diagram
API Server <-> etcd
etcd stores objects: Pods, Deployments, Services, Secrets, ConfigMaps, RBAC6. YAML / Commands / Configuration
kubectl get all -A
kubectl get secrets -A
kubectl get configmaps -A
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| get all -A | Shows many objects stored through the API. |
| secrets/configmaps | Examples of state stored in cluster. |
| backup | etcd backup depends on cluster setup. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Scheduler
1. Clear Definition
Scheduler: The scheduler assigns unscheduled Pods to suitable nodes.
2. Explanation for New People
A Pod must be placed on a node before kubelet can start it. The scheduler chooses the node.
3. Detailed Study Explanation
The scheduler considers resource requests, node selectors, affinity, taints, tolerations, volumes, and other constraints. Pending Pods often mean scheduling failed, not app code failed.
4. Business Use Case
A high-memory analytics Pod stays Pending until nodes with enough memory are available or requests are reduced.
5. Mental Model / Diagram
New Pod -> scheduler checks constraints -> node selected -> kubelet starts containers6. YAML / Commands / Configuration
kubectl get pods
kubectl describe pod <pod>
kubectl get nodes
kubectl top nodes
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| describe pod | Shows scheduling events. |
| top nodes | Shows resource usage if metrics exist. |
| Pending | Often means scheduling or volume issue. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Controllers and Reconciliation
1. Clear Definition
Controllers and Reconciliation: Controllers continuously compare desired state and actual state, then act to reduce differences.
2. Explanation for New People
Kubernetes behaves like a thermostat. You set desired state, controllers keep checking and adjusting.
3. Detailed Study Explanation
A Deployment controller ensures desired replicas exist. A Job controller ensures tasks complete. Node controllers watch node health. This is why a deleted Pod managed by Deployment comes back.
4. Business Use Case
A payment API needs 4 replicas. If one Pod fails, controllers create a replacement without a human restarting it.
5. Mental Model / Diagram
Desired: 4 replicas
Actual: 3 Pods
Controller creates 1 more Pod6. YAML / Commands / Configuration
kubectl create deployment web --image=nginx --replicas=3
kubectl delete pod <pod>
kubectl get pods -w
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| delete pod | Removes actual Pod. |
| get pods -w | Watch replacement appear. |
| Deployment | Owns ReplicaSet/Pods. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Worker Node, kubelet, kube-proxy, and Runtime
1. Clear Definition
Worker Node, kubelet, kube-proxy, and Runtime: A worker node runs Pods using kubelet, kube-proxy, and a container runtime.
2. Explanation for New People
Worker nodes do the actual application work.
3. Detailed Study Explanation
kubelet receives Pod specs assigned to the node and ensures containers run. The container runtime starts containers. kube-proxy helps implement Service networking. Node health affects scheduling and Pod availability.
4. Business Use Case
If a node is NotReady due to disk pressure, workloads on it may fail or stop receiving new Pods.
5. Mental Model / Diagram
Node: kubelet + kube-proxy + runtime + Pods6. YAML / Commands / Configuration
kubectl get nodes -o wide
kubectl describe node <node>
kubectl get pods -o wide
kubectl top nodes
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| describe node | Shows node conditions and events. |
| get pods -o wide | Shows node placement. |
| top nodes | Shows resource usage. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
kubectl, kubeconfig, Contexts, and Namespaces
1. Clear Definition
kubectl, kubeconfig, Contexts, and Namespaces: kubectl is the CLI; kubeconfig stores cluster access; context selects cluster, user, and namespace.
2. Explanation for New People
kubectl needs to know which cluster to talk to. kubeconfig and context decide that.
3. Detailed Study Explanation
Many accidents happen because kubectl points to the wrong cluster or namespace. Always check current context before applying important changes. Namespaces are logical areas inside a cluster.
4. Business Use Case
A developer accidentally deploys test YAML to production because the wrong context is active. Context checks prevent this.
5. Mental Model / Diagram
kubectl -> kubeconfig -> context -> API server
context = cluster + user + namespace6. YAML / Commands / Configuration
kubectl config get-contexts
kubectl config current-context
kubectl config use-context <context>
kubectl config set-context --current --namespace=dev
kubectl get pods -n dev
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| get-contexts | Lists contexts. |
| current-context | Shows active target. |
| use-context | Switches target. |
| -n dev | Targets namespace dev. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Kubernetes YAML Object Structure
1. Clear Definition
Kubernetes YAML Object Structure: Kubernetes manifests usually contain apiVersion, kind, metadata, spec, and status.
2. Explanation for New People
YAML is how you describe desired state.
3. Detailed Study Explanation
apiVersion selects API version. kind says resource type. metadata names and labels the object. spec describes what you want. status is written by Kubernetes to show what actually happened. Store manifests in Git for repeatability.
4. Business Use Case
Teams review YAML in pull requests before applying changes, improving auditability.
5. Mental Model / Diagram
apiVersion: which API
kind: resource type
metadata: name/labels
spec: desired state
status: observed state6. YAML / Commands / Configuration
kubectl explain deployment.spec
kubectl apply --dry-run=server -f app.yaml
kubectl apply -f app.yaml
kubectl get deployment app -o yaml
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| explain | Shows field documentation. |
| dry-run=server | Validates without saving. |
| apply | Applies desired state. |
| -o yaml | Shows full object with status. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Declarative Apply vs Imperative Commands
1. Clear Definition
Declarative Apply vs Imperative Commands: Imperative commands tell Kubernetes what to do now; declarative manifests describe desired state in files.
2. Explanation for New People
Imperative is quick for learning; declarative is better for teams.
3. Detailed Study Explanation
Production teams prefer YAML stored in Git because changes are reviewable and repeatable. kubectl diff shows changes before apply. Generated YAML from dry-run can help students start manifests.
4. Business Use Case
A team uses Git-reviewed manifests for dev, QA, and prod instead of manual cluster edits.
5. Mental Model / Diagram
Imperative: kubectl create deployment
Declarative: deployment.yaml + kubectl apply -f6. YAML / Commands / Configuration
kubectl create deployment web --image=nginx --dry-run=client -o yaml > deployment.yaml
kubectl diff -f deployment.yaml
kubectl apply -f deployment.yaml
kubectl delete -f deployment.yaml
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| dry-run=client -o yaml | Generates YAML. |
| diff | Shows changes. |
| apply | Applies manifest. |
| delete -f | Deletes manifest resources. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Namespaces
1. Clear Definition
Namespaces: Namespaces provide logical separation of resources within one cluster.
2. Explanation for New People
A namespace is like a project area inside a cluster.
3. Detailed Study Explanation
Namespaces organize resources and support scoped RBAC, quotas, and policies. They are not strong security by themselves, but they become useful with RBAC, NetworkPolicy, and quotas.
4. Business Use Case
Each team gets a namespace with permissions and quota to reduce interference.
5. Mental Model / Diagram
Cluster -> namespaces: dev, qa, prod, monitoring
Namespaced objects: Pods, Services, ConfigMaps, Secrets6. YAML / Commands / Configuration
kubectl get namespaces
kubectl create namespace dev
kubectl get pods -n dev
kubectl delete namespace dev
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| get namespaces | Lists namespaces. |
| create namespace | Creates logical area. |
| -n dev | Targets namespace dev. |
| delete namespace | Deletes resources inside namespace too. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Labels, Selectors, and Annotations
1. Clear Definition
Labels, Selectors, and Annotations: Labels identify and group objects; selectors find objects by labels; annotations store extra metadata.
2. Explanation for New People
Services and Deployments often connect to Pods through labels, not names.
3. Detailed Study Explanation
A Service selector must match Pod labels to send traffic. Deployment selectors must match template labels to manage Pods. Annotations are for tool metadata, not selection.
4. Business Use Case
A Service fails because selector app=payment does not match Pods labeled app=payments. Fixing labels restores endpoints.
5. Mental Model / Diagram
Pod labels: app=api, tier=backend
Service selector: app=api
If match -> endpoints exist6. YAML / Commands / Configuration
kubectl get pods --show-labels
kubectl get pods -l app=web
kubectl label pod <pod> environment=dev
kubectl describe svc <service>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| --show-labels | Shows labels. |
| -l app=web | Filters by label. |
| label pod | Adds label. |
| describe svc | Shows selector/endpoints. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Pods
1. Clear Definition
Pods: A Pod is the smallest deployable Kubernetes compute object and can contain one or more containers sharing network and storage.
2. Explanation for New People
Kubernetes runs containers inside Pods, not as top-level container objects.
3. Detailed Study Explanation
A Pod has one IP and is scheduled to one node. Containers in the same Pod can share localhost and volumes. In production, Pods are usually created by Deployments or other controllers because standalone Pods are not self-healing.
4. Business Use Case
A web API runs as Pods managed by a Deployment with multiple replicas.
5. Mental Model / Diagram
Pod -> one or more containers
Pod has shared IP, shared volumes, node placement6. YAML / Commands / Configuration
kubectl run nginx --image=nginx --restart=Never
kubectl get pods -o wide
kubectl describe pod nginx
kubectl logs nginx
kubectl delete pod nginx
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| run nginx | Creates a test Pod. |
| -o wide | Shows Pod IP/node. |
| describe | Shows events. |
| logs | Shows container output. |
8. Common Mistakes
- Using standalone Pods for production apps.
- Expecting Pod IP to be stable.
- Putting unrelated services in one Pod.
- Ignoring controllers that own Pods.
9. Troubleshooting Steps
- If Pending, describe Pod.
- If CrashLoopBackOff, check logs and --previous logs.
- If image pull fails, check image/tag/registry.
10. Student Practice
- Create a Pod.
- View IP and node.
- Read logs.
- Delete it and explain why Deployment is better.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Multi-container Pods and Sidecars
1. Clear Definition
Multi-container Pods and Sidecars: A multi-container Pod runs tightly coupled containers together; a sidecar supports the main container.
2. Explanation for New People
Use sidecars when containers must share network, volumes, and lifecycle.
3. Detailed Study Explanation
Sidecars are used for logging, proxying, service mesh, config reloaders, and helper tasks. Do not put unrelated services together just to reduce YAML. If services scale independently, use separate workloads.
4. Business Use Case
An app writes logs to shared volume and sidecar ships them to logging system.
5. Mental Model / Diagram
Pod: app container + sidecar container
Shared localhost and volumes
Same node and lifecycle6. YAML / Commands / Configuration
apiVersion: v1
kind: Pod
metadata:
name: sidecar-demo
spec:
containers:
- name: app
image: nginx
- name: helper
image: busybox
command: ["sh","-c","while true; do echo helper; sleep 10; done"]
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| containers list | Multiple containers in one Pod. |
| app | Main container. |
| helper | Sidecar/helper. |
| same Pod | Shared network/volumes when configured. |
8. Common Mistakes
- Putting unrelated apps together.
- Forgetting -c container when checking logs.
- No resource requests for sidecar.
- Sidecar failure affects Pod behavior.
9. Troubleshooting Steps
- Use kubectl logs pod -c container.
- Describe Pod and check all container statuses.
- Check shared volumes.
10. Student Practice
- Create two-container Pod.
- Read logs from each container.
- Explain sidecar vs separate Deployment.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Init Containers
1. Clear Definition
Init Containers: Init containers run before app containers and must complete successfully before the main containers start.
2. Explanation for New People
Use init containers for setup work before the app starts.
3. Detailed Study Explanation
Init containers run sequentially. Each must finish successfully. They are useful for setup, validation, or waiting logic, but not for long-running services. If an init container fails, the app container never starts.
4. Business Use Case
An init container prepares a config file in a shared volume before the main app starts.
5. Mental Model / Diagram
init 1 -> completes
init 2 -> completes
app containers start6. YAML / Commands / Configuration
apiVersion: v1
kind: Pod
metadata:
name: init-demo
spec:
initContainers:
- name: init
image: busybox
command: ["sh","-c","echo preparing; sleep 5"]
containers:
- name: app
image: nginx
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| initContainers | Setup containers. |
| must complete | Main app waits. |
| containers | Main app after init phase. |
8. Common Mistakes
- Using init container for long-running service.
- Not checking init logs.
- Init command not idempotent.
- Init failure blocks app startup.
9. Troubleshooting Steps
- If Pod shows Init error, use kubectl logs pod -c init-name.
- Describe Pod for init events.
- Ensure init exits 0.
10. Student Practice
- Create init demo.
- Break init command.
- Read init logs.
- Explain startup sequence.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
ReplicaSets
1. Clear Definition
ReplicaSets: A ReplicaSet ensures a specified number of matching Pods are running.
2. Explanation for New People
ReplicaSet is the replica guard, but Deployments usually manage ReplicaSets for you.
3. Detailed Study Explanation
ReplicaSets use label selectors. Deployments create new ReplicaSets during rollouts. You should understand ReplicaSet to understand Deployment behavior, but usually create Deployments directly.
4. Business Use Case
A Deployment keeps 3 replicas by using a ReplicaSet; if one Pod is deleted, a replacement appears.
5. Mental Model / Diagram
Deployment -> ReplicaSet -> Pods
ReplicaSet desired: 3
Actual: 2 -> creates 16. YAML / Commands / Configuration
kubectl create deployment web --image=nginx --replicas=3
kubectl get rs
kubectl get pods --show-labels
kubectl describe rs <rs>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| get rs | Lists ReplicaSets. |
| show-labels | Shows selector labels. |
| describe rs | Shows replica status/events. |
8. Common Mistakes
- Creating ReplicaSet directly for normal apps.
- Selector mismatch.
- Confusing ReplicaSet and Deployment.
- Deleting ReplicaSet owned by Deployment.
9. Troubleshooting Steps
- Check Deployment -> ReplicaSet -> Pod ownership.
- Compare selectors and labels.
- Describe ReplicaSet for events.
10. Student Practice
- Create Deployment.
- Find ReplicaSet.
- Scale Deployment.
- Observe ReplicaSet.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Deployments
1. Clear Definition
Deployments: A Deployment manages stateless application Pods and provides declarative updates through ReplicaSets.
2. Explanation for New People
Deployment is the main object for web apps and APIs.
3. Detailed Study Explanation
A Deployment defines replicas, selector, and Pod template. It supports scaling, rolling updates, rollback, and self-healing. It is best for stateless workloads where replicas are interchangeable.
4. Business Use Case
A customer API runs with 4 replicas and rolls out new versions gradually.
5. Mental Model / Diagram
Deployment -> ReplicaSet -> Pods
Update image -> new ReplicaSet grows, old shrinks6. YAML / Commands / Configuration
kubectl create deployment web --image=nginx --replicas=3
kubectl get deployment,rs,pods
kubectl set image deployment/web nginx=nginx:1.25
kubectl rollout status deployment/web
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| create deployment | Creates workload. |
| --replicas | Desired Pod count. |
| set image | Triggers rollout. |
| rollout status | Watches update. |
8. Common Mistakes
- Using Pod directly for apps.
- Selector does not match template labels.
- Using latest tag.
- No readiness probe.
9. Troubleshooting Steps
- If rollout stuck, describe Deployment and new Pods.
- Check image pull and readiness.
- Check logs of new Pods.
10. Student Practice
- Create Deployment.
- Scale replicas.
- Update image.
- Check ReplicaSets.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Rolling Updates and Rollbacks
1. Clear Definition
Rolling Updates and Rollbacks: A rolling update gradually replaces old Pods with new Pods; rollback returns to a previous Deployment revision.
2. Explanation for New People
This is how Kubernetes releases app versions with less downtime.
3. Detailed Study Explanation
Rolling updates use maxUnavailable and maxSurge to control rollout speed. Readiness probes are important because Kubernetes should not send traffic to an unready Pod. Rollback helps recover, but it must be planned with database changes and image tags.
4. Business Use Case
A bad frontend release is rolled back quickly using kubectl rollout undo.
5. Mental Model / Diagram
v1 ReplicaSet down gradually
v2 ReplicaSet up gradually
rollback -> v1 scales back6. YAML / Commands / Configuration
kubectl set image deployment/web nginx=nginx:1.25
kubectl rollout status deployment/web
kubectl rollout history deployment/web
kubectl rollout undo deployment/web
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| set image | Starts rollout. |
| history | Shows revisions. |
| undo | Rolls back. |
| status | Shows progress. |
8. Common Mistakes
- No readiness probe.
- Using latest tag.
- No rollout monitoring.
- Rollback after incompatible DB change.
9. Troubleshooting Steps
- If rollout stuck, check Pods and readiness.
- Use rollout history.
- Check Deployment events.
10. Student Practice
- Perform rollout.
- Watch status.
- Rollback.
- Write release checklist.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
StatefulSets
1. Clear Definition
StatefulSets: A StatefulSet manages stateful applications that need stable identity, ordered deployment, and stable storage.
2. Explanation for New People
Stateful apps often need stable names and storage.
3. Detailed Study Explanation
StatefulSet Pods get predictable names like db-0 and db-1. They can use volumeClaimTemplates to create stable PVCs. StatefulSet helps with mechanics but does not replace database backup, replication, or administration.
4. Business Use Case
A distributed database uses stable Pod identity and PVCs.
5. Mental Model / Diagram
StatefulSet -> db-0, db-1, db-2
Each Pod -> stable PVC6. YAML / Commands / Configuration
kubectl get statefulsets
kubectl get pods
kubectl get pvc
kubectl describe statefulset <name>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| statefulsets | Stateful workloads. |
| pods | Stable ordinal names. |
| pvc | Stable storage claims. |
| describe | Events and template. |
8. Common Mistakes
- Using StatefulSet without database knowledge.
- No backup.
- Deleting PVC accidentally.
- Assuming StatefulSet provides HA automatically.
9. Troubleshooting Steps
- Check PVC binding.
- Check Pod ordinal and logs.
- Check storage events.
- Review app-specific clustering.
10. Student Practice
- Study a StatefulSet YAML.
- Identify serviceName and volumeClaimTemplates.
- Explain Deployment vs StatefulSet.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
DaemonSets
1. Clear Definition
DaemonSets: A DaemonSet ensures a copy of a Pod runs on all or selected nodes.
2. Explanation for New People
Use DaemonSet for per-node agents.
3. Detailed Study Explanation
Log collectors, monitoring agents, CNI components, and security agents often use DaemonSets. When a new node joins, the DaemonSet can create a Pod there. DaemonSets may need tolerations or special permissions, so security review matters.
4. Business Use Case
Every node runs a log shipping agent using a DaemonSet.
5. Mental Model / Diagram
node-1 -> agent Pod
node-2 -> agent Pod
new node -> agent Pod added6. YAML / Commands / Configuration
kubectl get daemonsets -A
kubectl describe daemonset <name> -n <ns>
kubectl get pods -o wide -n <ns>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| get daemonsets -A | Lists DaemonSets. |
| describe | Shows desired/current/ready. |
| -o wide | Shows node placement. |
8. Common Mistakes
- Using DaemonSet for normal web app.
- Ignoring resource cost on every node.
- Too much privilege.
- Missing tolerations.
9. Troubleshooting Steps
- Check desired/current counts.
- Check node selectors/tolerations.
- Check Pod logs per node.
10. Student Practice
- Find DaemonSets in kube-system.
- Explain why node agents use DaemonSet.
- Draw per-node model.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Jobs and CronJobs
1. Clear Definition
Jobs and CronJobs: A Job runs Pods to completion; a CronJob creates Jobs on a schedule.
2. Explanation for New People
Not every workload is a web server. Some tasks run and finish.
3. Detailed Study Explanation
Jobs are for batch or one-time tasks. CronJobs are scheduled tasks. Design jobs to be idempotent if possible. Consider retries, concurrency, missed schedules, and cleanup history.
4. Business Use Case
A finance system generates reconciliation reports every night using a CronJob.
5. Mental Model / Diagram
Job: run -> complete
CronJob: schedule -> Job -> Pod -> complete6. YAML / Commands / Configuration
kubectl create job hello --image=busybox -- echo hello
kubectl logs job/hello
kubectl create cronjob hello-cron --image=busybox --schedule="*/5 * * * *" -- echo scheduled
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| create job | Creates one-time task. |
| logs job/name | Reads Job logs. |
| create cronjob | Creates scheduled Job. |
| --schedule | Cron timing. |
8. Common Mistakes
- Using Deployment for batch task.
- No idempotency.
- Wrong cron schedule.
- Ignoring failed Jobs.
9. Troubleshooting Steps
- Check Job Pods and logs.
- Describe CronJob.
- Check schedule/concurrency/history.
10. Student Practice
- Create Job.
- Read logs.
- Create CronJob.
- Delete after lab.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Kubernetes Service Overview
1. Clear Definition
Kubernetes Service Overview: A Service provides a stable network endpoint for a set of Pods selected by labels.
2. Explanation for New People
Pods are replaceable and IPs change; Services give stable access.
3. Detailed Study Explanation
Services select Pods using labels and route traffic to ready endpoints. Types include ClusterIP, NodePort, LoadBalancer, and ExternalName. A Service with no matching Pods has no endpoints.
4. Business Use Case
Frontend calls backend through backend Service even while backend Pods change.
5. Mental Model / Diagram
Client -> Service -> EndpointSlices -> Pods6. YAML / Commands / Configuration
kubectl expose deployment web --port=80 --target-port=80
kubectl get svc
kubectl describe svc web
kubectl get endpointslices
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| port | Service port. |
| targetPort | Pod/container port. |
| selector | Chooses Pods. |
| EndpointSlices | Actual backends. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
ClusterIP Service
1. Clear Definition
ClusterIP Service: ClusterIP is the default Service type for internal cluster access.
2. Explanation for New People
Use ClusterIP when only Pods inside the cluster need access.
3. Detailed Study Explanation
ClusterIP gives a stable internal virtual IP and DNS name. It is usually the right choice for backend APIs, databases, and internal services.
4. Business Use Case
API service is internal-only; frontend calls it by service name.
5. Mental Model / Diagram
frontend Pod -> api ClusterIP Service -> api Pods6. YAML / Commands / Configuration
apiVersion: v1
kind: Service
metadata:
name: api
spec:
type: ClusterIP
selector:
app: api
ports:
- port: 8080
targetPort: 8080
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| type: ClusterIP | Internal Service. |
| selector | Pod labels. |
| port | Service port. |
| targetPort | Pod port. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
NodePort and LoadBalancer Services
1. Clear Definition
NodePort and LoadBalancer Services: NodePort exposes a Service on each node; LoadBalancer asks infrastructure for an external load balancer.
2. Explanation for New People
Use these when traffic needs to come from outside the cluster.
3. Detailed Study Explanation
NodePort is simple but exposes node ports. LoadBalancer is common in cloud clusters. For many HTTP apps, Ingress or Gateway is often better than one LoadBalancer per app.
4. Business Use Case
A demo app gets a temporary external endpoint through LoadBalancer Service.
5. Mental Model / Diagram
Client -> LoadBalancer -> Service -> Pods
Client -> NodeIP:NodePort -> Service -> Pods6. YAML / Commands / Configuration
kubectl expose deployment web --type=NodePort --port=80
kubectl get svc web
kubectl expose deployment web-lb --type=LoadBalancer --port=80
kubectl get svc web-lb
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| NodePort | Opens node port. |
| LoadBalancer | Requests external load balancer. |
| EXTERNAL-IP | External address when available. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
EndpointSlices and Service Backends
1. Clear Definition
EndpointSlices and Service Backends: EndpointSlices track backend network endpoints for Services.
2. Explanation for New People
A Service needs actual backend Pods; EndpointSlices show them.
3. Detailed Study Explanation
If a Service selector matches Pods, Kubernetes creates EndpointSlices. Empty endpoints usually mean label mismatch or Pods not ready. EndpointSlices are very useful for troubleshooting Service failures.
4. Business Use Case
A Service has no traffic because EndpointSlices are empty due to wrong label selector.
5. Mental Model / Diagram
Service selector -> matching Pods -> EndpointSlices -> traffic targets6. YAML / Commands / Configuration
kubectl describe svc <service>
kubectl get endpointslices
kubectl get pods --show-labels
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| describe svc | Shows selector and endpoints summary. |
| get endpointslices | Shows backend endpoints. |
| show-labels | Compare labels. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Ingress
1. Clear Definition
Ingress: Ingress defines HTTP and HTTPS routing rules to Services based on hostnames and paths.
2. Explanation for New People
Ingress is for web routing. It is a rule, not the proxy itself.
3. Detailed Study Explanation
You need an Ingress Controller to implement Ingress. Ingress can route by host/path and terminate TLS depending on controller. Annotations are often controller-specific.
4. Business Use Case
app.example.com routes to frontend Service and api.example.com routes to API Service.
5. Mental Model / Diagram
Browser -> Ingress Controller -> Ingress rule -> Service -> Pods6. YAML / Commands / Configuration
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app
spec:
rules:
- host: app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 80
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| host | Hostname rule. |
| path | URL path rule. |
| backend service | Service target. |
| pathType | Path matching behavior. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Ingress Controller and Gateway API
1. Clear Definition
Ingress Controller and Gateway API: An Ingress Controller implements Ingress rules; Gateway API provides newer, more expressive traffic routing resources.
2. Explanation for New People
Ingress object alone does not route traffic; a controller must read it.
3. Detailed Study Explanation
Controller choice matters: NGINX, cloud provider, Traefik, HAProxy, etc. Gateway API separates infrastructure and app routing with GatewayClass, Gateway, and route resources. Learn Ingress first, then Gateway API.
4. Business Use Case
Platform team owns Gateway; app teams own HTTPRoutes.
5. Mental Model / Diagram
Ingress: Ingress + Controller
Gateway: GatewayClass -> Gateway -> Route -> Service6. YAML / Commands / Configuration
kubectl get ingressclass
kubectl get ingress -A
kubectl get gatewayclass
kubectl get httproute -A
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| ingressclass | Controller class. |
| gatewayclass | Gateway implementation class. |
| httproute | Route object if Gateway API installed. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Kubernetes DNS and CoreDNS
1. Clear Definition
Kubernetes DNS and CoreDNS: Kubernetes DNS lets Pods discover Services by name.
2. Explanation for New People
Apps should use service names, not Pod IPs.
3. Detailed Study Explanation
CoreDNS commonly provides DNS. Service names work inside the cluster, such as api or api.default.svc.cluster.local. DNS failures can break apps even when Pods are running.
4. Business Use Case
Frontend calls http://api instead of a changing Pod IP.
5. Mental Model / Diagram
Pod asks DNS -> Service name resolves -> traffic goes to Service6. YAML / Commands / Configuration
kubectl get svc
kubectl get pods -n kube-system -l k8s-app=kube-dns
kubectl run dns-test --image=busybox:1.36 --restart=Never -- sleep 3600
kubectl exec -it dns-test -- nslookup kubernetes.default
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| service name | Stable DNS name. |
| CoreDNS | Cluster DNS component. |
| nslookup | Tests DNS from inside Pod. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
ConfigMaps
1. Clear Definition
ConfigMaps: A ConfigMap stores non-confidential configuration data for Pods.
2. Explanation for New People
Use ConfigMap for log level, environment name, URLs, and feature flags.
3. Detailed Study Explanation
ConfigMaps decouple non-secret config from images. Pods can consume them as environment variables, command arguments, or mounted files. Do not store passwords in ConfigMaps.
4. Business Use Case
Same image runs in dev/prod with different ConfigMap values.
5. Mental Model / Diagram
Image stays same
ConfigMap changes by environment
Pod consumes ConfigMap6. YAML / Commands / Configuration
kubectl create configmap app-config --from-literal=APP_ENV=dev --from-literal=LOG_LEVEL=info
kubectl get configmap app-config -o yaml
# envFrom:
# - configMapRef:
# name: app-config
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| ConfigMap | Non-secret config. |
| --from-literal | Creates key-value entry. |
| envFrom | Loads all keys as env vars. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Secrets
1. Clear Definition
Secrets: A Secret stores sensitive data such as passwords, tokens, keys, and certificates.
2. Explanation for New People
Use Secrets instead of putting passwords in images or ConfigMaps.
3. Detailed Study Explanation
Secrets reduce exposure but are not magic. Access must be restricted with RBAC, and production clusters often use encryption at rest or external secret managers. Base64 is not the same as strong encryption.
4. Business Use Case
Database password is stored as a Secret and referenced by the API Deployment.
5. Mental Model / Diagram
Secret -> Pod env var or mounted file
Protected by RBAC and policy6. YAML / Commands / Configuration
kubectl create secret generic db-secret --from-literal=DB_PASSWORD=change-me
kubectl get secret db-secret
# secretKeyRef:
# name: db-secret
# key: DB_PASSWORD
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| Secret | Sensitive value object. |
| secretKeyRef | Reads one key into container. |
| RBAC | Controls who can read Secrets. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Environment Variables in Pods
1. Clear Definition
Environment Variables in Pods: Environment variables pass runtime configuration into containers.
2. Explanation for New People
Use env vars to configure the same image differently in each environment.
3. Detailed Study Explanation
Kubernetes env values can be direct, from ConfigMaps, from Secrets, or from Pod fields. Document required env vars. Large config files may be better as mounted ConfigMaps.
4. Business Use Case
One API image uses APP_ENV=dev in dev and APP_ENV=prod in production.
5. Mental Model / Diagram
Image + runtime env = configured container6. YAML / Commands / Configuration
env:
- name: APP_ENV
value: dev
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: app-config
key: DB_HOST
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: DB_PASSWORD
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| value | Plain non-secret value. |
| configMapKeyRef | Reads ConfigMap key. |
| secretKeyRef | Reads Secret key. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Volumes
1. Clear Definition
Volumes: A volume lets containers in a Pod access and share filesystem data.
2. Explanation for New People
Containers are replaceable; volumes provide filesystem data sources.
3. Detailed Study Explanation
Volumes are defined at Pod level and mounted into containers. emptyDir is temporary. ConfigMap and Secret volumes expose files. PVC volumes connect to persistent storage. Not every volume is persistent.
4. Business Use Case
A file-processing Pod uses emptyDir for temporary scratch files.
5. Mental Model / Diagram
Pod volume -> mounted into container path
emptyDir temporary, PVC persistent6. YAML / Commands / Configuration
apiVersion: v1
kind: Pod
metadata:
name: volume-demo
spec:
volumes:
- name: cache
emptyDir: {}
containers:
- name: app
image: busybox
command: ["sh","-c","echo hi > /cache/file; sleep 3600"]
volumeMounts:
- name: cache
mountPath: /cache
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| volumes | Defines volume source. |
| emptyDir | Temporary Pod-lifetime storage. |
| volumeMounts | Mounts into container. |
| mountPath | Path inside container. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
PersistentVolume, PVC, and StorageClass
1. Clear Definition
PersistentVolume, PVC, and StorageClass: PV is cluster storage, PVC requests storage, and StorageClass defines dynamic provisioning.
2. Explanation for New People
Apps request storage with PVC; the cluster provides PV.
3. Detailed Study Explanation
This separates app needs from storage implementation. StorageClass can dynamically provision cloud disks or other storage. Deleting PVC may delete or retain underlying storage depending on policy. Always understand data lifecycle.
4. Business Use Case
PostgreSQL uses a PVC so data survives Pod replacement.
5. Mental Model / Diagram
Pod -> PVC -> PV -> real storage
StorageClass defines how PV is created6. YAML / Commands / Configuration
kubectl get storageclass
kubectl get pv
kubectl get pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| PVC | Request for storage. |
| PV | Actual storage object. |
| StorageClass | Provisioning type. |
| ReadWriteOnce | Common access mode. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Liveness, Readiness, and Startup Probes
1. Clear Definition
Liveness, Readiness, and Startup Probes: Probes tell Kubernetes whether a container is alive, ready for traffic, or still starting.
2. Explanation for New People
Running does not always mean healthy or ready.
3. Detailed Study Explanation
Readiness controls Service traffic. Liveness restarts stuck containers. Startup protects slow-starting apps from early liveness failure. Bad probes can cause outages, so design health endpoints carefully.
4. Business Use Case
Readiness keeps traffic away from API Pods until DB connection is ready.
5. Mental Model / Diagram
Startup: still booting?
Readiness: should receive traffic?
Liveness: should restart?6. YAML / Commands / Configuration
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
livenessProbe:
httpGet:
path: /live
port: 8080
initialDelaySeconds: 30
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| readinessProbe | Controls endpoints/traffic. |
| livenessProbe | Controls restarts. |
| startupProbe | For slow start apps. |
| initialDelaySeconds | Delay before checks. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Resource Requests and Limits
1. Clear Definition
Resource Requests and Limits: Requests are used for scheduling; limits cap container CPU and memory usage.
2. Explanation for New People
Kubernetes needs resource information to place Pods safely.
3. Detailed Study Explanation
CPU can be throttled at limits. Memory over limit can cause OOMKilled. Requests that are too high cause Pending. No requests can cause noisy-neighbor problems. Tune using metrics.
4. Business Use Case
A reporting service gets memory limit to avoid hurting other workloads.
5. Mental Model / Diagram
request = reserve for scheduling
limit = maximum allowed
memory over limit -> OOMKilled6. YAML / Commands / Configuration
resources:
requests:
cpu: "250m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
kubectl top pod
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| requests | Scheduling and baseline. |
| limits | Maximum usage. |
| 250m | Quarter CPU. |
| kubectl top | Shows metrics if installed. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Horizontal Pod Autoscaler
1. Clear Definition
Horizontal Pod Autoscaler: HPA automatically adjusts replica count based on metrics such as CPU utilization.
2. Explanation for New People
When load increases, HPA can add Pods.
3. Detailed Study Explanation
HPA needs metrics and usually resource requests. Apps must be horizontally scalable. Set min/max replicas and test behavior under load. Autoscaling does not fix slow code or database bottlenecks.
4. Business Use Case
Exam registration API scales up during peak traffic and down later.
5. Mental Model / Diagram
Metrics high -> HPA -> increase replicas -> more Pods6. YAML / Commands / Configuration
kubectl autoscale deployment api --cpu-percent=60 --min=2 --max=10
kubectl get hpa
kubectl describe hpa api
kubectl top pods
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| cpu-percent | Target utilization. |
| min/max | Replica boundaries. |
| get hpa | Shows scaling state. |
| metrics | Required for decisions. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
nodeSelector, Affinity, and Anti-Affinity
1. Clear Definition
nodeSelector, Affinity, and Anti-Affinity: Scheduling rules influence where Pods run based on node labels, topology, and relationship to other Pods.
2. Explanation for New People
Use these rules when Pods need special nodes or spreading.
3. Detailed Study Explanation
nodeSelector is simple required matching. Affinity is more expressive. Anti-affinity can spread replicas across nodes or zones for availability. Too many strict rules can leave Pods Pending.
4. Business Use Case
Payment replicas are spread across zones to reduce outage risk.
5. Mental Model / Diagram
node labels + selectors/affinity -> scheduler placement6. YAML / Commands / Configuration
kubectl label node <node> disk=ssd
# Pod snippet
nodeSelector:
disk: ssd
kubectl get pods -o wide
kubectl describe pod <pod>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| nodeSelector | Requires node label. |
| affinity | Advanced placement rule. |
| anti-affinity | Spread away from matching Pods. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Taints and Tolerations
1. Clear Definition
Taints and Tolerations: Taints repel Pods from nodes; tolerations allow Pods to schedule onto tainted nodes.
2. Explanation for New People
A taint is like a warning sign; toleration is permission to enter.
3. Detailed Study Explanation
Toleration does not force placement, it only allows it. Combine toleration with nodeSelector/affinity for dedicated nodes. Effects include NoSchedule, PreferNoSchedule, and NoExecute.
4. Business Use Case
GPU nodes are tainted so only ML workloads can run there.
5. Mental Model / Diagram
Node taint: dedicated=gpu:NoSchedule
Pod toleration: dedicated=gpu
Allowed, not forced6. YAML / Commands / Configuration
kubectl taint nodes <node> dedicated=gpu:NoSchedule
# toleration snippet
tolerations:
- key: dedicated
operator: Equal
value: gpu
effect: NoSchedule
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| taint | Repels Pods. |
| toleration | Allows scheduling. |
| NoSchedule | Blocks without toleration. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
ServiceAccounts
1. Clear Definition
ServiceAccounts: A ServiceAccount provides an identity for processes running in Pods.
2. Explanation for New People
Pods use ServiceAccounts like humans use user accounts.
3. Detailed Study Explanation
Use dedicated ServiceAccounts for workloads that access the Kubernetes API. Connect permissions with RBAC. Avoid giving powerful permissions to default ServiceAccount.
4. Business Use Case
A deployment automation Pod gets read-only permissions in one namespace.
5. Mental Model / Diagram
Pod -> ServiceAccount -> RBAC -> API permissions6. YAML / Commands / Configuration
kubectl create serviceaccount app-sa
# Pod snippet
serviceAccountName: app-sa
kubectl auth can-i get pods --as=system:serviceaccount:default:app-sa
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| serviceAccountName | Assigns identity to Pod. |
| auth can-i --as | Tests permissions as that identity. |
| RBAC | Grants permissions. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
RBAC
1. Clear Definition
RBAC: RBAC controls who can perform which actions on Kubernetes resources.
2. Explanation for New People
RBAC answers: who can do what?
3. Detailed Study Explanation
Role is namespace-scoped. ClusterRole is cluster-scoped or reusable. RoleBinding grants in a namespace. ClusterRoleBinding grants cluster-wide. Verbs include get, list, create, update, delete.
4. Business Use Case
Developers can manage Deployments in dev but cannot read production Secrets.
5. Mental Model / Diagram
Subject -> Role/ClusterRole -> Binding -> permissions6. YAML / Commands / Configuration
kubectl create role pod-reader --verb=get,list,watch --resource=pods -n dev
kubectl create rolebinding read-pods --role=pod-reader --serviceaccount=dev:app-sa -n dev
kubectl auth can-i list pods -n dev --as=system:serviceaccount:dev:app-sa
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| Role | Namespace permissions. |
| RoleBinding | Grants Role to subject. |
| verb/resource | Allowed action and target. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
NetworkPolicies
1. Clear Definition
NetworkPolicies: NetworkPolicies control allowed network traffic to and from Pods when supported by the CNI plugin.
2. Explanation for New People
Use NetworkPolicy to restrict Pod communication.
3. Detailed Study Explanation
Policies select Pods by labels and define allowed ingress/egress. If a Pod is selected for a direction, traffic not allowed is denied. DNS must often be allowed explicitly.
4. Business Use Case
Database accepts traffic only from API Pods.
5. Mental Model / Diagram
Without policy: broad traffic
With policy: only selected sources/ports allowed6. YAML / Commands / Configuration
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-api-to-db
spec:
podSelector:
matchLabels:
app: db
policyTypes: [Ingress]
ingress:
- from:
- podSelector:
matchLabels:
app: api
ports:
- protocol: TCP
port: 5432
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| podSelector | Pods protected by policy. |
| from | Allowed sources. |
| port | Allowed destination port. |
| CNI | Must support NetworkPolicy. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Pod Security Standards
1. Clear Definition
Pod Security Standards: Pod Security Standards define security profiles such as privileged, baseline, and restricted.
2. Explanation for New People
They help prevent unsafe Pod settings.
3. Detailed Study Explanation
Restricted policies encourage non-root, no privileged mode, limited capabilities, and safer defaults. Apply policies carefully with audit/warn before enforce in important namespaces.
4. Business Use Case
Application namespaces enforce baseline/restricted rules to reduce risk.
5. Mental Model / Diagram
Privileged -> broad access
Baseline -> safer default
Restricted -> strongest standard for normal apps6. YAML / Commands / Configuration
kubectl label namespace dev pod-security.kubernetes.io/enforce=baseline
kubectl label namespace dev pod-security.kubernetes.io/warn=restricted
# securityContext:
# runAsNonRoot: true
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| namespace labels | Configure Pod Security Admission. |
| enforce | Blocks violations. |
| warn | Warns without blocking. |
| runAsNonRoot | Safer runtime setting. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
ResourceQuota and LimitRange
1. Clear Definition
ResourceQuota and LimitRange: ResourceQuota limits total namespace usage; LimitRange sets default and allowed ranges for individual resources.
2. Explanation for New People
Shared clusters need guardrails.
3. Detailed Study Explanation
Quota prevents one namespace from using all CPU, memory, Pods, Services, or PVCs. LimitRange can set default requests/limits. These policies may block Pod creation if requests are missing or quota is exceeded.
4. Business Use Case
Each project namespace gets a CPU/memory quota for cost and stability.
5. Mental Model / Diagram
Namespace quota = total cap
LimitRange = defaults/min/max per object6. YAML / Commands / Configuration
apiVersion: v1
kind: ResourceQuota
metadata:
name: dev-quota
spec:
hard:
requests.cpu: "4"
requests.memory: 8Gi
pods: "20"
---
apiVersion: v1
kind: LimitRange
metadata:
name: default-limits
spec:
limits:
- type: Container
defaultRequest:
cpu: "250m"
memory: "256Mi"
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| ResourceQuota | Namespace total limits. |
| LimitRange | Default/min/max. |
| requests | Needed for scheduling and quota accounting. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Helm
1. Clear Definition
Helm: Helm is a Kubernetes package manager that uses charts to template, install, upgrade, and roll back applications.
2. Explanation for New People
Helm packages many YAML files into a reusable chart.
3. Detailed Study Explanation
Charts contain templates and values. Values differ by environment. Helm tracks releases and supports upgrade/rollback. Learn raw Kubernetes YAML first so Helm templates make sense.
4. Business Use Case
Same app chart deploys to dev and prod with different values files.
5. Mental Model / Diagram
Chart templates + values -> rendered manifests -> cluster release6. YAML / Commands / Configuration
helm create myapp
helm template myapp ./myapp
helm install myapp ./myapp
helm upgrade myapp ./myapp -f values-prod.yaml
helm rollback myapp 1
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| helm template | Renders YAML. |
| install | Creates release. |
| upgrade | Updates release. |
| rollback | Returns release revision. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Kustomize
1. Clear Definition
Kustomize: Kustomize customizes Kubernetes YAML using bases and overlays without templates.
2. Explanation for New People
Use Kustomize when environments share mostly the same YAML with small differences.
3. Detailed Study Explanation
A base contains common manifests. Overlays patch replicas, images, labels, namespaces, or config for dev/prod. kubectl apply -k can apply a kustomization directory.
4. Business Use Case
Dev overlay uses 1 replica; prod overlay uses 5 replicas and production image tag.
5. Mental Model / Diagram
base/ + overlays/dev + overlays/prod
base YAML reused, overlays patch differences6. YAML / Commands / Configuration
kubectl kustomize overlays/dev
kubectl apply -k overlays/dev
# kustomization.yaml
resources:
- ../../base
images:
- name: myapp
newTag: dev
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| kustomize | Renders final YAML. |
| apply -k | Applies kustomization. |
| resources | Base resources. |
| images | Image override. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Logs, Events, Metrics, and Debugging
1. Clear Definition
Logs, Events, Metrics, and Debugging: Kubernetes observability uses logs, events, metrics, describe output, and exec/debug tools.
2. Explanation for New People
Do not guess; read Kubernetes signals.
3. Detailed Study Explanation
Use get for status, describe for details/events, logs for container output, events for timeline, top for metrics, and exec for inside-container checks. Pending Pods need events; CrashLoopBackOff needs logs; Service failures need endpoints.
4. Business Use Case
A rollout fails; describe shows readiness failures and logs show DB timeout.
5. Mental Model / Diagram
Status -> get
Events -> describe/get events
Output -> logs
Usage -> top
Inside -> exec6. YAML / Commands / Configuration
kubectl get pods
kubectl describe pod <pod>
kubectl logs <pod>
kubectl logs <pod> -c <container>
kubectl get events --sort-by=.lastTimestamp
kubectl top pods
kubectl exec -it <pod> -- sh
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| describe | Events and config. |
| logs | Container output. |
| -c | Container name for multi-container Pod. |
| top | Metrics if installed. |
| exec | Run command in Pod. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Pod Troubleshooting: Pending, CrashLoopBackOff, ImagePullBackOff
1. Clear Definition
Pod Troubleshooting: Pending, CrashLoopBackOff, ImagePullBackOff: Common Pod states indicate scheduling, app crash, or image pull problems.
2. Explanation for New People
Status words are clues.
3. Detailed Study Explanation
Pending often means scheduling/volume constraints. CrashLoopBackOff means container starts then crashes. ImagePullBackOff means image cannot be pulled. Use describe for Pending/image issues and logs for crashes.
4. Business Use Case
Release fails because new image tag was not pushed; Pods show ImagePullBackOff.
5. Mental Model / Diagram
Pending -> scheduling/volume
CrashLoopBackOff -> app crash
ImagePullBackOff -> image/registry6. YAML / Commands / Configuration
kubectl get pods
kubectl describe pod <pod>
kubectl logs <pod>
kubectl logs <pod> --previous
kubectl get events --sort-by=.lastTimestamp
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| describe | Best for Pending/image errors. |
| logs | Best for app crash. |
| --previous | Previous crashed container logs. |
| events | Failure timeline. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Service and Ingress Troubleshooting
1. Clear Definition
Service and Ingress Troubleshooting: Service and Ingress troubleshooting follows the traffic path from client to Pods.
2. Explanation for New People
A running Pod does not guarantee app is reachable.
3. Detailed Study Explanation
Check Pods ready, Service selector, EndpointSlices, port/targetPort, DNS, Ingress controller, Ingress rules, TLS, and backend Service. Debug from inside the cluster before blaming external DNS.
4. Business Use Case
A portal returns 404 because Ingress backend Service name is wrong.
5. Mental Model / Diagram
Client -> DNS -> Ingress Controller -> Ingress -> Service -> EndpointSlices -> Pods6. YAML / Commands / Configuration
kubectl get pods --show-labels
kubectl describe svc <svc>
kubectl get endpointslices
kubectl describe ingress <ing>
kubectl get ingress -A
kubectl logs -n <ingress-ns> <controller-pod>
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| show-labels | Compare labels. |
| describe svc | Selector/endpoints. |
| endpointslices | Backends. |
| describe ingress | Rules/events. |
| controller logs | Proxy/controller errors. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Project 1: Deploy a Web API with Deployment and Service
1. Clear Definition
Project 1: Deploy a Web API with Deployment and Service: Deploying a web API with Deployment and Service proves core Kubernetes workload and networking skills.
2. Explanation for New People
Start with one simple API image and make it run reliably.
3. Detailed Study Explanation
Create deployment.yaml and service.yaml. Add labels, replicas, readiness probe, resources, and versioned image tag. README should include apply, verify, logs, scale, update, rollback, and cleanup.
4. Business Use Case
A customer profile API runs with 3 replicas behind a Service.
5. Mental Model / Diagram
Image -> Deployment -> ReplicaSet -> Pods
Service -> stable endpoint to Pods6. YAML / Commands / Configuration
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl get deployment,pods,svc
kubectl logs deployment/customer-api
kubectl scale deployment customer-api --replicas=5
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| deployment.yaml | Workload desired state. |
| service.yaml | Stable network endpoint. |
| scale | Change replicas. |
| logs deployment/name | Read app logs. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Project 2: Full App with ConfigMap, Secret, PVC, and Ingress
1. Clear Definition
Project 2: Full App with ConfigMap, Secret, PVC, and Ingress: This project combines configuration, secrets, persistent storage, service networking, and HTTP routing.
2. Explanation for New People
A strong portfolio project should include more than one object.
3. Detailed Study Explanation
Build API + database. API reads ConfigMap/Secret. Database uses PVC. Service connects components. Ingress exposes HTTP. Add README architecture, commands, screenshots, troubleshooting, and cleanup.
4. Business Use Case
Student registration platform stores data in PostgreSQL and exposes API at student.example.com.
5. Mental Model / Diagram
Client -> Ingress -> API Service -> API Pods -> DB Service -> DB Pod -> PVC
ConfigMap/Secret -> API Pods6. YAML / Commands / Configuration
kubectl apply -f namespace.yaml
kubectl apply -f configmap.yaml
kubectl apply -f secret.yaml
kubectl apply -f db-pvc.yaml
kubectl apply -f db.yaml
kubectl apply -f api-deployment.yaml
kubectl apply -f api-service.yaml
kubectl apply -f ingress.yaml
kubectl get pods,svc,pvc,ingress -n student-app
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| namespace | Project area. |
| configmap/secret | Config and sensitive values. |
| pvc | Persistent DB storage. |
| ingress | HTTP entry point. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |
12. Official Study Links for This Chapter
Kubernetes Interview Preparation for Freshers
1. Clear Definition
Kubernetes Interview Preparation for Freshers: Interview preparation means explaining Kubernetes concepts with definition, purpose, YAML/commands, project example, and troubleshooting.
2. Explanation for New People
Interviewers want understanding, not memorized commands only.
3. Detailed Study Explanation
Use this answer format: definition, why it matters, real example, command/YAML, common mistake, troubleshooting. Prepare examples for Pod states, Service endpoints, rollouts, ConfigMaps/Secrets, PVC Pending, RBAC forbidden, and Ingress routing.
4. Business Use Case
A strong fresher answer connects Kubernetes to availability, scaling, deployment safety, configuration, security, and recovery.
5. Mental Model / Diagram
Answer format:
Definition
Why it matters
Example
YAML/command
Mistake
Troubleshooting6. YAML / Commands / Configuration
kubectl get pods
kubectl describe pod <pod>
kubectl logs <pod>
kubectl get svc
kubectl get ingress
kubectl rollout status deployment/<name>
kubectl auth can-i get pods
7. Command / YAML Breakdown
| Item | Meaning for beginners |
|---|---|
| get/describe/logs | Core troubleshooting. |
| rollout status | Deployment release status. |
| auth can-i | RBAC check. |
| svc/ingress | Networking objects. |
8. Common Mistakes
- Reading only theory and not running kubectl commands.
- Changing many things at the same time during troubleshooting.
- Ignoring namespaces, labels, events, and describe output.
- Using production-like commands without understanding cleanup impact.
9. Troubleshooting Steps
- Start with kubectl get to see status.
- Use kubectl describe to read events and configuration.
- Use kubectl logs only after the container actually starts.
- Check namespace, labels, selectors, image names, and permissions.
10. Student Practice
- Write the definition in your own words.
- Run the command in a local test cluster.
- Break one setting intentionally and observe the error.
- Write expected result, actual result, root cause, and fix.
11. Notebook Notes to Write
| Definition | Rewrite this chapter definition in your own words. |
|---|---|
| Why it matters | Write the business or project problem this solves. |
| YAML or command proof | Paste your manifest, terminal output, or screenshot. |
| Failure example | Write one mistake and how you fixed it. |
| Portfolio proof | Add README notes, manifest snippets, architecture diagram, and screenshots. |