
One slide :: HL on TLS


Lab Environment:
Task 1: Explore Kubernetes Workloads
Objective: Identify Deployments, ReplicaSets, StatefulSets, DaemonSets, Jobs and CronJobs.
kubectl get all -A
kubectl get deployments -A
kubectl get replicasets -A
kubectl get statefulsets -A
kubectl get daemonsets -A
kubectl get jobs,cronjobs -A
kubectl explain deployment
kubectl explain deployment.spec
Exercise: Explain the difference between Deployment, StatefulSet, DaemonSet and Job.
Task 2: Create and Manage Deployments
Objective: Deploy Nginx and manage application replicas.
kubectl create namespace cka-unit2
kubectl create deployment nginx –image=nginx:stable –replicas=3 -n cka-unit2
kubectl get deployments -n cka-unit2
kubectl get pods -n cka-unit2 -o wide
kubectl get rs -n cka-unit2
kubectl describe deployment nginx -n cka-unit2
kubectl scale deployment nginx –replicas=5 -n cka-unit2
kubectl get pods -n cka-unit2
Expected: Five Nginx Pods running under one Deployment.
Exercise: Scale the Deployment down to two replicas.
Task 3: Rolling Updates and Rollbacks
Objective: Update application images and restore previous versions.
kubectl set image deployment/nginx nginx=nginx:alpine -n cka-unit2
kubectl rollout status deployment/nginx -n cka-unit2
kubectl rollout history deployment/nginx -n cka-unit2
kubectl rollout undo deployment/nginx -n cka-unit2
kubectl rollout restart deployment/nginx -n cka-unit2
kubectl get deployment nginx -n cka-unit2 -o jsonpath='{.spec.template.spec.containers[*].image}’
Exercise: Deploy an invalid image, identify the failure and roll back.
Task 4: Deployment Strategies and Resource Management
Objective: Configure CPU, memory and rolling-update parameters.
kubectl set resources deployment nginx –requests=cpu=100m,memory=64Mi –limits=cpu=500m,memory=256Mi -n cka-unit2
kubectl describe deployment nginx -n cka-unit2
kubectl top pods -n cka-unit2
kubectl patch deployment nginx -n cka-unit2 –type=strategic -p ‘{“spec”:{“strategy”:{“type”:”RollingUpdate”,”rollingUpdate”:{“maxSurge”:1,”maxUnavailable”:0}}}}’
kubectl get deployment nginx -n cka-unit2 -o yaml
Exercise: Explain maxSurge, maxUnavailable, requests and limits.
Task 5: ConfigMaps and Secrets
Objective: Manage application configuration and sensitive values.
kubectl create configmap app-config –from-literal=APP_MODE=production -n cka-unit2
kubectl create secret generic app-secret –from-literal=DB_PASSWORD=test123 -n cka-unit2
kubectl get configmaps -n cka-unit2
kubectl get secrets -n cka-unit2
kubectl describe configmap app-config -n cka-unit2
kubectl describe secret app-secret -n cka-unit2
kubectl set env deployment/nginx –from=configmap/app-config -n cka-unit2
kubectl exec -n cka-unit2 deployment/nginx — printenv APP_MODE
Exercise: Create a ConfigMap containing two environment variables and verify them inside a Pod.
Task 6: Helm Package Manager
Objective: Install Kubernetes applications using Helm.
helm version
helm list -A
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm search repo nginx
helm show chart bitnami/nginx
helm show values bitnami/nginx
helm install webapp bitnami/nginx -n cka-unit2
helm list -n cka-unit2
helm status webapp -n cka-unit2
helm get manifest webapp -n cka-unit2
kubectl get pods,svc -n cka-unit2
Exercise: Identify the Helm release name, chart version and application version.
Note: Helm chart availability and container-image access may vary.
Task 7: Helm Upgrades and Rollbacks
Objective: Upgrade, inspect and restore Helm releases.
helm show values bitnami/nginx > values.yaml
helm get values webapp -n cka-unit2
helm upgrade webapp bitnami/nginx -n cka-unit2 –set service.type=ClusterIP
helm history webapp -n cka-unit2
helm rollback webapp 1 -n cka-unit2
helm status webapp -n cka-unit2
helm template webapp bitnami/nginx -n cka-unit2 > rendered.yaml
helm uninstall webapp -n cka-unit2
Exercise: Upgrade a Helm release and roll back to revision 1.
Task 8: Kubernetes Scheduling
Objective: Understand how the scheduler selects nodes.
kubectl get nodes -o wide
kubectl get pods -A -o wide
kubectl describe node k8sw1
kubectl describe node k8sw2
kubectl get nodes –show-labels
kubectl describe nodes | grep -A 8 ‘Allocated resources’
kubectl get pods -n kube-system -l component=kube-scheduler
kubectl logs -n kube-system kube-scheduler-k8sm –tail=50
kubectl get events -A –sort-by=.metadata.creationTimestamp
Exercise: Identify which worker nodes host the Nginx replicas and inspect their scheduling events.
Task 9: NodeSelector and Node Affinity
Objective: Schedule workloads onto specific nodes.
kubectl label node k8sw1 disktype=ssd
kubectl get nodes –show-labels
kubectl run node-test –image=nginx:stable -n cka-unit2 –dry-run=client -o yaml > node-test.yaml
Edit node-test.yaml and add under spec:
nodeSelector:
disktype: ssd
kubectl apply -f node-test.yaml
kubectl get pod node-test -n cka-unit2 -o wide
kubectl describe pod node-test -n cka-unit2
Exercise: Configure required node affinity for k8sw1 and compare it with nodeSelector.
Task 10: Taints and Tolerations
Objective: Restrict workload scheduling on worker nodes.
kubectl taint nodes k8sw2 dedicated=testing:NoSchedule
kubectl describe node k8sw2 | grep Taints
kubectl get nodes -o wide
Create toleration.yaml:
apiVersion: v1
kind: Pod
metadata:
name: toleration-test
namespace: cka-unit2
spec:
nodeSelector:
kubernetes.io/hostname: k8sw2
tolerations:
kubectl apply -f toleration.yaml
kubectl get pod toleration-test -n cka-unit2 -o wide
kubectl taint nodes k8sw2 dedicated=testing:NoSchedule-
Exercise: Explain NoSchedule, PreferNoSchedule and NoExecute.
Task 11: Pod Affinity and Anti-Affinity
Objective: Control Pod placement relative to other Pods.
kubectl get pods -n cka-unit2 -o wide
kubectl get nodes -L kubernetes.io/hostname
kubectl edit deployment nginx -n cka-unit2
Add under spec.template.spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
– labelSelector:
matchLabels:
app: nginx
topologyKey: kubernetes.io/hostname
kubectl get pods -n cka-unit2 -o wide
kubectl describe deployment nginx -n cka-unit2
kubectl get events -n cka-unit2 –sort-by=.metadata.creationTimestamp
Exercise: Verify that matching replicas run on different eligible nodes. Extra replicas may remain Pending if there are insufficient nodes.
Task 12: Cordon, Drain and Uncordon
Objective: Perform Kubernetes node maintenance.
kubectl get nodes
kubectl cordon k8sw1
kubectl get nodes
kubectl drain k8sw1 –ignore-daemonsets –delete-emptydir-data
kubectl get pods -A -o wide
kubectl uncordon k8sw1
kubectl get nodes
Exercise: Explain the differences between cordon, drain and uncordon.
Warning: Run drain only on a disposable lab worker, as it can disrupt running applications.
Task 13: Troubleshoot Pending Pods
Objective: Identify scheduling failures.
kubectl get pods -A –field-selector=status.phase=Pending
kubectl describe pod node-test -n cka-unit2
kubectl get events -n cka-unit2 –sort-by=.metadata.creationTimestamp
kubectl describe nodes
kubectl get nodes –show-labels
kubectl describe nodes | grep -i taints
kubectl top nodes
Exercise: Create a Pod with a nonexistent nodeSelector label, diagnose FailedScheduling and correct the configuration.
Task 14: Workload Troubleshooting
Objective: Investigate unhealthy Pods and application failures.
kubectl get pods -A –field-selector=status.phase!=Running,status.phase!=Succeeded
kubectl get deployments -A
kubectl get replicasets -A
kubectl describe pods -n cka-unit2
kubectl logs deployment/nginx -n cka-unit2
kubectl rollout status deployment/nginx -n cka-unit2
kubectl get events -n cka-unit2 –sort-by=.metadata.creationTimestamp
kubectl top pods -n cka-unit2
Exercise: Simulate ImagePullBackOff, inspect Pod events and restore a working image.
Task 15: Cleanup and Cluster Verification
Objective: Remove lab resources and restore normal scheduling.
kubectl delete namespace cka-unit2
kubectl label node k8sw1 disktype-
kubectl taint nodes k8sw2 dedicated=testing:NoSchedule-
kubectl uncordon k8sw1
kubectl uncordon k8sw2
kubectl get nodes
kubectl get pods -n kube-system
kubectl get namespaces
kubectl get pods -A -o wide
Exercise: Verify that all three nodes are Ready, worker nodes are schedulable and the lab namespace has been removed.
Objective: Identify control-plane components, worker components, and their responsibilities.
kubectl get nodes -o wide
kubectl get pods -n kube-system -o wide
kubectl get pods -n kube-system | grep -E
‘apiserver|scheduler|controller|etcd’
kubectl get –raw=’/readyz?verbose’
kubectl cluster-info
Expected: All three nodes are Ready. API server, scheduler, controller-manager, and etcd are healthy.
Objective: Learn to inspect node conditions, capacity, and cluster resources.
kubectl get nodes
kubectl describe node k8sw1
kubectl top nodes
kubectl top pods -A
kubectl get all -A
kubectl describe nodes | grep -A 8 “Allocated resources”
kubectl get events -A –sort-by=.lastTimestamp
Exercise: Identify which worker has the highest CPU usage and check whether any pod is failing.
Objective: Understand how kubeadm bootstraps Kubernetes clusters.
Run on the control-plane node:
kubeadm version
kubectl -n kube-system get cm kubeadm-config -o yaml
kubectl -n kube-system get cm kubelet-config -o yaml
sudo systemctl status kubelet
sudo ls -l /etc/kubernetes/manifests/
sudo kubeadm certs check-expiration
Exercise: Find the API server endpoint, Pod CIDR, and Kubernetes version.
Objective: Understand Pod networking, Services, DNS, and CNI.
kubectl get pods -A -o wide
kubectl get svc -A
kubectl get daemonset -n kube-flannel
kubectl get pods -n kube-flannel -o wide
kubectl get pods -n kube-system -l k8s-app=kube-dns
kubectl run dns-test
–image=busybox:1.36
–restart=Never
–command — sleep 3600
kubectl exec dns-test — nslookup kubernetes.default.svc.cluster.local
kubectl delete pod dns-test
Exercise: Verify that CoreDNS resolves Kubernetes Service names.
Objective: Practice Deployments, replicas, scaling, and rollout management.
kubectl create deployment web –image=nginx:stable
kubectl scale deployment web –replicas=3
kubectl expose deployment web
–port=80 –target-port=80
kubectl get deployments,pods,svc -o wide
kubectl set image deployment/web nginx=nginx:alpine
kubectl rollout status deployment/web
kubectl rollout history deployment/web
kubectl rollout undo deployment/web
Exercise: Confirm that three replicas are running and distributed across available nodes.
Objective: Safely remove workloads from a worker node for maintenance.
kubectl cordon k8sw1
kubectl drain k8sw1
–ignore-daemonsets
–delete-emptydir-data
kubectl get nodes
kubectl uncordon k8sw1
kubectl describe node k8sw1
Important: drain can disrupt applications, and --delete-emptydir-data permits deletion of temporary Pod data. Practice only with disposable workloads.
Exercise: Explain the difference between cordon, drain, and uncordon.
Objective: Identify failed workloads and troubleshoot Kubernetes components.
kubectl get pods -A
–field-selector=status.phase!=Running,status.phase!=Succeeded
kubectl get deployments -A
kubectl get daemonsets -A
kubectl describe pod -n
kubectl logs -n
kubectl logs -n –previous
sudo journalctl -u kubelet -n 100 –no-pager
Exercise: Create a pod with an invalid image and diagnose the ImagePullBackOff error.
Objective: Implement least-privilege API access.
kubectl create namespace cka-lab
kubectl create serviceaccount cka-reader -n cka-lab
kubectl create role pod-reader
–verb=get,list,watch
–resource=pods
-n cka-lab
kubectl create rolebinding pod-reader-binding
–role=pod-reader
–serviceaccount=cka-lab:cka-reader
-n cka-lab
kubectl auth can-i list pods
–as=system:serviceaccount:cka-lab:cka-reader
-n cka-lab
kubectl auth can-i delete pods
–as=system:serviceaccount:cka-lab:cka-reader
-n cka-lab
Expected: Listing pods returns yes; deleting pods returns no.
Objective: Understand the kubeadm upgrade workflow.
For a practice lab, begin with read-only checks:
kubectl version
kubeadm version
kubelet –version
kubectl get nodes -o wide
sudo kubeadm upgrade plan
Upgrade workflow to study:
Do not execute an upgrade without checking version compatibility, package repositories, and the official version-specific procedure.
Objective: Understand etcd, control-plane redundancy, and recovery.
kubectl get pods -n kube-system | grep etcd
kubectl logs -n kube-system etcd-k8sm –tail=50
sudo cat /etc/kubernetes/manifests/etcd.yaml
kubectl get nodes
-l node-role.kubernetes.io/control-plane
kubectl get endpoints kubernetes -n default
Exercise: Explain why a single control-plane cluster is not highly available and why a three-member etcd cluster can tolerate one member failure.
Plain-text reference guide for Kubernetes administrators and CKA preparation.
K8s – Kubernetes (K + 8 letters + s).
Cluster – Group of nodes managed by Kubernetes.
Node – Physical or virtual machine participating in a cluster.
Control Plane – Components responsible for managing cluster state.
Worker Node – Machine that runs application workloads.
Pod – Smallest deployable Kubernetes unit; one or more containers.
Container – Isolated application process environment.
Namespace – A Namespace is a Kubernetes resource that logically separates and organizes resources within a single cluster.
It provides:
Use Cases: Development, testing, production, and multi-team environments.
Key Point: Namespaces provide logical separation, not complete security or network isolation by default.
Manifest – YAML or JSON definition of a Kubernetes resource.
Desired State – Target configuration Kubernetes attempts to maintain.
Reconciliation – Process of bringing actual state toward desired state.
kubectl – Command-line client for the Kubernetes API.
kubeconfig – Configuration for clusters, users, and contexts.
Context – Selected cluster, user, and optional namespace.
API – Application Programming Interface.
YAML – YAML Ain’t Markup Language.
JSON – JavaScript Object Notation.
CRI – Container Runtime Interface.
OCI – Open Container Initiative.
CNI – Container Network Interface.
CSI – Container Storage Interface.
kube-apiserver – Exposes and validates the Kubernetes API.
etcd – Distributed key-value database storing cluster state.
kube-scheduler – Assigns unscheduled Pods to suitable nodes.
kube-controller-manager – Runs core reconciliation controllers.
cloud-controller-manager (CCM) – Integrates cloud provider infrastructure.
kubelet – Node agent that manages Pod execution.
kube-proxy – Implements Service networking on nodes (when deployed).
CRD – CustomResourceDefinition; adds a custom API resource type.
Leader Election – Selects an active leader among controller replicas.
Deployment – A Deployment is a Kubernetes resource that manages application Pods through ReplicaSets.
It provides:
Architecture: Deployment → ReplicaSet → Pods
ReplicaSet – A ReplicaSet is a Kubernetes resource that ensures the desired number of identical Pod replicas are running at all times.
It provides:
Architecture: Deployment → ReplicaSet → Pods
Key Point: ReplicaSets are typically managed by Deployments rather than directly.
StatefulSet – A StatefulSet is a Kubernetes resource that manages stateful applications requiring stable identities, persistent storage, and ordered deployment.
It provides:
Architecture: StatefulSet → Pods → Persistent Volumes (PVCs)
Use Cases: Databases (MySQL, PostgreSQL, MongoDB), Kafka, and other stateful applications.
Key Point: Unlike Deployments, StatefulSets maintain stable Pod identities and storage across Pod replacements.
DaemonSet -A DaemonSet is a Kubernetes resource that ensures a copy of a specific Pod runs on every eligible node (or selected nodes) in a cluster.
It provides:
Architecture: DaemonSet → One Pod per Eligible Node
Use Cases: Log collection (Fluent Bit), monitoring (Prometheus Node Exporter), and networking (Flannel, Calico).
Key Point: Unlike Deployments, DaemonSets ensure node-level Pod coverage rather than maintaining a fixed number of replicas.
Job – Runs tasks to completion.
CronJob (CJ) – Creates Jobs on a schedule.
Init – Container Runs setup tasks before application containers start.
Sidecar – Container Helper container supporting an application container.
Ephemeral Container – Temporary container for interactive troubleshooting.
HPA – Horizontal Pod Autoscaler; adjusts replica count.
VPA – Vertical Pod Autoscaler; recommends/adjusts Pod resources.
PDB – Pod Disruption Budget; limits voluntary disruptions.
Rolling Update – Gradually replaces old Pods with new Pods.
Rollback – Returns a workload to an earlier revision.
Restart Policy – Rules governing container restarts within a Pod.
CNI – Container Network Interface.
CoreDNS – DNS server commonly used for Kubernetes discovery.
ClusterIP – Service type reachable within the cluster.
NodePort – A NodePort is a Kubernetes Service type that exposes an application externally through a specific port on every cluster node.
It provides:
NodeIP:NodePort.Architecture: Client → NodeIP:NodePort → Kubernetes Service → Pods
Example Command:
LoadBalancer – A LoadBalancer is a Kubernetes Service type that exposes an application externally and distributes incoming network traffic across its backend Pods.
It provides:
Architecture: Client → External Load Balancer → Kubernetes Service → Pods
Example Command:
kubectl expose deployment nginx \
--type=LoadBalancer \
--port=80
Key Point: A LoadBalancer Service provides external access to applications. On bare-metal clusters, an additional load balancer implementation, such as MetalLB, is typically required.
ExternalName – Service type returning a DNS alias.
Ingress API – resource describing HTTP/HTTPS routing rules.
Ingress – Controller Software that implements Ingress rules.
Gateway API – APIs for flexible service traffic routing.
NetworkPolicy – Policy controlling selected Pod ingress/egress traffic.
Pod CIDR – IP address range used for Pods.
Service CIDR – IP address range used for Services.
eBPF – Extended Berkeley Packet Filter.
Flannel – Kubernetes CNI network plugin.
Calico – Kubernetes networking and network policy solution.
Cilium – eBPF-based networking, security, and observability solution.
Volume – Storage exposed to containers in a Pod.
PV – PersistentVolume; cluster storage resource.
PVC – PersistentVolumeClaim; request for persistent storage.
SC – StorageClass; defines storage provisioning properties.
CSI – Container Storage Interface.
Storage Provisioner – Component that provisions storage volumes.
Dynamic Provisioning – Automatic creation of PVs for claims.
Static Provisioning – Pre-created PVs managed by administrators.
emptyDir – Ephemeral volume tied to a Pod’s lifetime.
hostPath – Mount of a node filesystem path into a Pod.
RWO – ReadWriteOnce; read/write mount by one node.
ROX – ReadOnlyMany; read-only mounts by many nodes.
RWX – ReadWriteMany; read/write mounts by many nodes.
RWOP – ReadWriteOncePod; exclusive read/write use by one Pod.
NFS – Network File System.
iSCSI – Internet Small Computer Systems Interface.
VolumeSnapshot – Snapshot resource supported by CSI snapshot components.
RBAC – Role-Based Access Control.
SA – ServiceAccount; identity for workloads.
Role – Set of permissions within a namespace.
ClusterRole – Permissions that can apply cluster-wide or to namespaces.
RoleBinding – Grants Role or ClusterRole permissions in a namespace.
ClusterRoleBinding – Grants ClusterRole permissions cluster-wide.
TLS – Transport Layer Security.
mTLS – Mutual Transport Layer Security.
CA – Certificate Authority.
CSR – Certificate Signing Request.
OIDC – OpenID Connect.
JWT – JSON Web Token.
PSA – Pod Security Admission.
PSS – Pod Security Standards.
SCC – Security Context Constraints (OpenShift).
Secret – Resource storing sensitive configuration data.
ConfigMap (CM) – Resource storing non-confidential configuration data.
Admission Controller – Validates or mutates API requests.
SecurityContext -Pod/container security settings.
CPU Request – CPU quantity used by the scheduler for placement.
CPU Limit Upper – CPU usage bound for a container.
Memory Request – Memory quantity used for scheduling.
Memory Limit – Upper memory bound for a container.
QoS – Quality of Service classification for Pods.
Guaranteed QoS – when CPU/memory requests equal limits for all containers.
Burstable QoS – with some requests/limits but not Guaranteed.
BestEffort QoS – without CPU/memory requests or limits.
Taint – Node restriction that repels non-tolerating Pods.
Toleration – Pod setting allowing scheduling past a matching taint.
NodeSelector – Label-based node selection.
Node Affinity – Flexible node scheduling constraints/preferences.
Pod Affinity – Places Pods near matching Pods.
Pod Anti-Affinity – Separates Pods from matching Pods.
Eviction – Removal of a Pod from a node.
OOMKilled – Container killed due to out-of-memory condition.
ResourceQuota – Limits aggregate resource usage in a namespace.
LimitRange – Defines defaults and bounds for resource requests/limits.
PriorityClass – Defines a Pod’s scheduling priority.
Metrics Server – Supplies resource metrics for kubectl top and HPA.
Prometheus – Metrics collection and time-series monitoring system.
Grafana – Dashboard and visualization platform.
kube-state-metrics (KSM) – Exposes Kubernetes object-state metrics.
Node Exporter – Exposes node OS and hardware metrics.
OpenTelemetry (OTel) – Framework for metrics, logs, and traces.
CRI-O – Kubernetes-compatible container runtime.
containerd – Container runtime commonly used with Kubernetes.
CrashLoopBackOff – Repeated container crashes with increasing restart delay.
ImagePullBackOff – Backoff after unsuccessful image pull attempts.
ErrImagePull – Image retrieval failed.
Pending Pod – accepted but not fully set up to run.
Running Pod – bound to a node; containers created, starting, or running.
Liveness – Probe Detects when a container should be restarted.
Readiness – Probe Controls whether a Pod is ready for Service traffic.
Startup Probe -Allows slow-starting applications to initialize.
Events Records – of notable resource-related occurrences.
kubectl logs – Displays container logs.
kubectl describe – Shows resource details and related events.
kubectl top – Displays resource usage when metrics are available.
kubeadm – Tool for bootstrapping Kubernetes clusters.
kubeadm init – Initializes a control plane.
kubeadm join – Adds a node to an existing cluster.
kubeadm upgrade – Assists with upgrades of kubeadm-managed clusters.
Helm – Kubernetes package manager.
Chart – Package of Kubernetes resources for Helm.
Release – Installed instance of a Helm chart.
Kustomize – Tool for customizing Kubernetes YAML configuration.
GitOps – Git-driven declarative deployment/operations approach.
Argo CD – GitOps continuous delivery controller.
Flux – GitOps toolkit for Kubernetes.
Drain – Evicts eligible Pods for node maintenance.
Cordon – Marks a node unschedulable.
Uncordon – Marks a node schedulable again.
CR – Custom Resource; instance of a custom API type.
Operator – Controller using Kubernetes APIs to manage applications.
API Aggregation – Adds extension API servers to Kubernetes API surface.
Webhook – HTTP callback used for admission or integration.
Service Mesh – Infrastructure for service-to-service traffic management.
Istio – Service mesh platform.
Envoy – High-performance network proxy.
gRPC – Remote Procedure Call framework.
HTTP/2 – Hypertext Transfer Protocol version 2.
OPA – Open Policy Agent.
Kyverno – Kubernetes-native policy engine.
KEDA Kubernetes Event-driven Autoscaling.
Karpenter – Kubernetes node provisioning/lifecycle system.
Cluster Autoscaler – Adjusts node group sizes to meet workload needs.
SLO – Service Level Objective.
SLI – Service Level Indicator.
SLA – Service Level Agreement.
RTO – Recovery Time Objective.
RPO – Recovery Point Objective.
DR – Disaster Recovery.
Pods po – kubectl get po
Deployments – deploy kubectl get deploy
Services svc – kubectl get svc
Namespaces ns – kubectl get ns
Nodes no – kubectl get no
ReplicaSets rs – kubectl get rs
DaemonSets ds – kubectl get ds
StatefulSets sts – kubectl get sts
ConfigMaps cm – kubectl get cm
ServiceAccounts sa – kubectl get sa
PersistentVolumes pv – kubectl get pv
PersistentVolumeClaims pvc – kubectl get pvc
StorageClasses sc – kubectl get sc
NetworkPolicies netpol – kubectl get netpol
HorizontalPodAutoscalers hpa – kubectl get hpa
PodDisruptionBudgets pdb – kubectl get pdb
CronJobs cj – kubectl get cj
Ingresses ing – kubectl get ing
Endpoints ep – kubectl get ep
Fundamentals -> Architecture -> Workloads -> Networking -> Storage ->
Security -> Scheduling -> Troubleshooting -> Cluster Administration
Kubernetes documentation: https://kubernetes.io/docs/home/
CKA certification: https://www.cncf.io/training/certification/cka/
END OF DOCUMENT
Nodes are not ready
Nodes are not fully ready: That’s why those are SchedulingDisabled (Cordoned)

Root cause: They were drained before shutdown

Need to uncordon both:

# Show client and server versions
kubectl –help
kubectl <command> –help
# Show client and server versions
kubectl version
# Show all nodes
kubectl get nodes
# Show node IPs, OS, runtime and versions
kubectl describe node k8sw1
# Show cluster control plane information
kubectl cluster-info

# List cluster nodes
kubectl get nodes
# Show node CPU and memory usage
kubectl top nodes
# Check API server readiness
kubectl get –raw /readyz
Check all nodes
kubectl get nodes -o wide

kubectl describe nodes: remove grep to view all

# List pods in default namespace
kubectl get pods
# List pods across all namespaces
kubectl get pods -A
Show detailed pod information
kubectl get pods -o wide
Create an nginx pod
kubectl run nginx –image=nginx
Describe a pod
kubectl describe pod nginx
View pod logs
kubectl logs nginx
Follow logs in real time
kubectl logs -f nginx
Execute a command inside a pod
kubectl exec nginx — ls /
Open an interactive shell
kubectl exec -it nginx — /bin/sh
Delete a pod
kubectl delete pod nginx
# List namespaces
kubectl get namespaces
# Create namespace
kubectl create namespace learning
List pods in namespace
kubectl get pods -n learning
Set default namespace for current context
kubectl config set-context –current –namespace=learning
Return to default namespace
kubectl config set-context –current –namespace=default
Delete namespace
kubectl delete namespace learning
Check all namespaces
kubectl get namespaces -o wide

Check pods across ALL namespaces
kubectl get pods -A -o wide

Find failed or pending Pods:

kubectl get pods -A | grep -vE ‘Running|Completed’

Note: there are no unhealthy pods right now
Find Pods with recent restarts:

Inspect a problematic Pod:
kubectl describe pod <pod-name> -n <namespace>


kubectl logs <pod-name> -n <namespace> --tail=100

Create deployment
kubectl create deployment webapp –image=nginx
# List deployments
kubectl get deployments
# Scale deployment to 3 replicas
kubectl scale deployment webapp –replicas=3
# Check deployment rollout
kubectl rollout status deployment/webapp
# Update container image
kubectl set image deployment/webapp nginx=nginx:1.27
# Check rollout history
kubectl rollout history deployment/webapp
# Roll back deployment
kubectl rollout undo deployment/webapp
# Delete deployment
kubectl delete deployment webapp
List services
kubectl get svc
Expose deployment using NodePort
kubectl expose deployment webapp –type=NodePort –port=80
# Show service details
kubectl describe svc webapp
# Show EndpointSlices
kubectl get endpointslices
# Forward local port to service
kubectl port-forward svc/webapp 8080:80
List network policies
kubectl get networkpolicies -A
# Delete service
kubectl delete svc webapp
kubectl get pods -n kube-system -o wide

kubectl get pods -n kube-flannel -o wide

kubectl get svc -A

kubectl get svc metrics-server -n kube-system

kubectl describe svc metrics-server -n kube-system

kubectl get endpoints -A

kubectl get endpoints metrics-server -n kube-system

kubectl get pods -n kube-system -l k8s-app=metrics-server -o wide

Check NodePort Services:

# View cluster events
kubectl get events -A
# Sort events by time
kubectl get events -A –sort-by=.lastTimestamp
# Investigate pod failures
kubectl describe pod POD_NAME
# Logs from previous container instance
kubectl logs POD_NAME –previous
# Show pod CPU and memory
kubectl top pods -A
# Find pending pods
kubectl get pods -A –field-selector=status.phase=Pending
# Identify pod placement
kubectl get pods -A -o wide
Note: kubectl get componentstatuses is a legacy command; avoid it for modern health checks.
kubectl cordon k8sw1
kubectl drain k8sw1 –ignore-daemonsets
kubectl uncordon k8sw1
kubectl get nodes –show-labels
kubectl label node k8sw1 environment=lab
kubectl label node k8sw1 environment-
WARNING: Draining a node evicts eligible workloads and can interrupt applications.
kubectl get deployments -A

kubectl describe deployment metrics-server -n kube-system


View Deployment logs:

View Deployment resource usage:

kubectl get daemonsets -A
kubectl get daemonsets -A -o wide

kubectl describe ds prometheus-prometheus-node-exporter -n monitoring


Troubleshoot unhealthy daemon set:

kubectl get pod nginx -o yaml
kubectl get deployment webapp -o yaml
kubectl apply -f deployment.yaml
kubectl apply –dry-run=server -f deployment.yaml
kubectl diff -f deployment.yaml
kubectl explain pod.spec
kubectl explain pod.spec.containers.resources
9. Check recent cluster events
kubectl get events -A –sort-by=’.lastTimestamp’ | tail -30

kubectl api-resources
kubectl api-versions
kubectl get all
kubectl get pods,deploy,svc,ds,sts -A
kubectl get daemonsets -A
kubectl get statefulsets -A
kubectl get configmaps -A
kubectl get secrets -A
kubectl top nodes:

kubectl top nodes

kubectl top pods -A

To get Node and Pod metrics you have install metrics-server service on kube-system name spaces

Day 1: Cluster, nodes, namespaces and pods
Day 2: Deployments, ReplicaSets and scaling
Day 3: Services, networking and DNS
Day 4: ConfigMaps, Secrets and storage
Day 5: DaemonSets, StatefulSets and Jobs
Day 6: Scheduling, taints, tolerations and node maintenance
Day 7: Troubleshooting, logs, events and YAML
CKA PRIORITIES
Focus on:
kubectl get
kubectl describe
kubectl logs
kubectl exec
kubectl apply
kubectl explain
kubectl rollout
kubectl cordon
kubectl drain
kubectl uncordon
Introduction
Kubernetes is an open-source platform that automates the deployment, scaling, networking, and management of containerized applications across a cluster.


Useful commands:
kubectl version, kubectl cluster-info, kubectl get nodes
2. Kubernetes Architecture: API Server, Scheduler, Controller Manager, etcd, kubelet, kube-proxy

Useful commands:
kubectl get pods -A, kubectl describe node
3. Cluster Installation: kubeadm, kubelet, kubectl, container runtime, cluster bootstrap

Useful commands:
kubeadm init, kubeadm join, kubectl get nodes
4. Pods & API Objects: Pods, YAML, namespaces, labels, annotations

Useful commands:
kubectl run, kubectl get pod, kubectl describe, kubectl apply -f
5. Deployments & Workloads: ReplicaSets, Deployments, scaling, rolling updates, rollback

Useful commands:
kubectl create deployment, kubectl scale, kubectl rollout
6. Services & Networking: ClusterIP, NodePort, service discovery, DNS, pod networking

Useful commands:
kubectl expose, kubectl get svc, kubectl get endpoints
7. Ingress & Gateway: Ingress Controller, HTTP routing, Gateway API

Useful commands:
Create an Ingress and route traffic to two Services
8. Kubernetes Storage: Volumes, PV, PVC, StorageClass, CSI, Ceph integration

Useful commands:
kubectl get pv,pvc,sc, create PVC and mount into a Pod
9. Helm & Kustomize: Package management, Helm charts, templating, overlays

Useful commands:
helm install, helm list, helm upgrade, kubectl apply -k
10. Scheduling & Security: Scheduler, affinity, taints/tolerations, RBAC, ServiceAccounts

Useful commands:
kubectl taint, kubectl auth can-i, kubectl create role
11. Troubleshooting & Logging: Logs, events, failed Pods, networking, resource problems

Useful commands:
12. HA + CKA Review: HA control plane, etcd, CRDs, backup/recovery, exam-style troubleshooting

Useful commands:
Mixed troubleshooting lab + CKA-style exercises
Conclusion
Kubernetes simplifies the deployment, scaling, management, and operation of containerized applications reliably and efficiently.
What is Storage?
Storage is the hardware or service used to save, retain, and retrieve digital data, either temporarily or permanently.
Main Storage Types
Different storage types provide different levels of performance, persistence, scalability, sharing, availability, and cost. Choosing the right type ensures applications get the required speed, reliability, data protection, and cost efficiency.

Kubernetes Storage Types

Main architectural components:
In simple terms:
OpenShift = Kubernetes + Networking + Security + Automation + Monitoring + Developer Tools.

In Cilium, eBPF is mainly used for:
In short: eBPF gives Cilium a programmable, efficient way to control and observe network traffic directly inside the Linux kernel.
In simple terms:
Pod → eBPF (Cilium) → Network → eBPF → Pod
eBPF allows Cilium to provide things such as network policies, load balancing, routing, service handling, and network visibility, often without relying heavily on traditional iptables.
