Listen to this Post

Introduction:
Kubernetes (K8s) has cemented its position as the de facto standard for container orchestration, powering everything from Netflix’s microservices to Spotify’s massive user base. As a DevOps engineer, cloud architect, or developer, mastering Kubernetes isn’t just a career advantage—it’s a necessity in today’s cloud-1ative landscape. This comprehensive quick revision guide distills the essential concepts, commands, and best practices you need to navigate Kubernetes with confidence, whether you’re preparing for the CKA exam or leveling up your production deployments.
Learning Objectives:
- Master the Kubernetes architecture and understand how control plane and worker nodes interact to orchestrate containerized workloads
- Gain proficiency with essential kubectl commands for managing pods, deployments, services, and cluster resources
- Implement robust security controls using RBAC, Network Policies, and Pod Security Standards to harden your clusters
- Deploy and expose applications using Deployments, Services, and Ingress controllers
- Manage persistent storage with PersistentVolumes, PersistentVolumeClaims, and StatefulSets for stateful applications
- Build end-to-end CI/CD pipelines integrating Jenkins, Docker, and Kubernetes on cloud platforms like Azure
- Understanding Kubernetes Architecture: The Control Plane and Worker Nodes
A Kubernetes cluster consists of two primary components: the control plane (the brain) and worker nodes (the muscle). The control plane makes global decisions about the cluster—scheduling, detecting, and responding to events—while worker nodes host the Pods that run your containerized applications.
Control Plane Components:
- kube-apiserver: The front-end for the control plane that exposes the Kubernetes API. It’s designed to scale horizontally by deploying multiple instances.
- etcd: A consistent and highly-available key-value store serving as Kubernetes’ backing store for all cluster data.
- kube-scheduler: Watches for newly created Pods with no assigned node and selects a node for them to run on.
- kube-controller-manager: Runs controller processes that regulate the state of the cluster.
Worker Node Components:
- kubelet: The primary node agent that communicates with the control plane and ensures containers are running as specified.
- kube-proxy: Maintains network rules on nodes, enabling communication to Pods from inside or outside the cluster.
- Container Runtime: The software that runs containers (e.g., Docker, containerd).
Verification Commands:
Check cluster information kubectl cluster-info List all nodes in the cluster kubectl get nodes Get detailed information about a specific node kubectl describe node <node-1ame> View control plane component status kubectl get componentstatuses
- Essential kubectl Commands: Your Daily Driver for Cluster Management
The `kubectl` command-line tool is your primary interface for interacting with Kubernetes clusters. It communicates with the API server over HTTP, transmitting instructions that update the cluster’s state in etcd.
Setting Up Productivity Aliases:
Create alias for kubectl
alias k=kubectl
Bash autocomplete setup
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
ZSH autocomplete setup
source <(kubectl completion zsh)
echo '[[ $commands[bash] ]] && source <(kubectl completion zsh)' >> ~/.zshrc
Context and namespace shortcuts
alias kx='f() { [ "$1" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'
alias kn='f() { [ "$1" ] && kubectl config set-context --current --1amespace $1 || kubectl config view --minify -o jsonpath="{..namespace}" ; } ; f'
Essential Commands Cheat Sheet:
| Operation | Command |
|–||
| Get all pods in current namespace | `kubectl get pods` |
| Get pods across all namespaces | `kubectl get pods -A` |
| Get pods with node information | `kubectl get pods -o wide` |
| Describe a pod | `kubectl describe pod
| View pod logs | `kubectl logs
| Stream pod logs | `kubectl logs -f
| Execute command in pod | `kubectl exec -it
| Apply a configuration | `kubectl apply -f
| Delete a resource | `kubectl delete -f
| Get all resources | `kubectl get all` |
Context and Configuration Management:
View merged kubeconfig settings kubectl config view List all contexts kubectl config get-contexts Display current context kubectl config current-context Switch to a different context kubectl config use-context my-cluster-1ame Set default namespace for current context kubectl config set-context --current --1amespace=my-1amespace
3. Deploying Applications: Pods, Deployments, and Services
Pods are the smallest deployable units in Kubernetes, representing one or more containers that share storage and network. Deployments provide declarative updates for Pods and ReplicaSets, enabling rolling updates and rollbacks. Services abstract access to a set of Pods, providing stable networking.
Creating a Deployment:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.25 ports: - containerPort: 80 resources: requests: memory: "64Mi" cpu: "250m" limits: memory: "128Mi" cpu: "500m"
Exposing with a Service:
apiVersion: v1 kind: Service metadata: name: nginx-service spec: selector: app: nginx ports: - port: 80 targetPort: 80 type: LoadBalancer
Deployment Commands:
Create deployment imperatively kubectl create deployment nginx --image=nginx:1.25 --replicas=3 Expose deployment as service kubectl expose deployment nginx --port=80 --type=LoadBalancer Scale deployment kubectl scale deployment nginx --replicas=5 Perform rolling update kubectl set image deployment/nginx nginx=nginx:1.26 Rollback deployment kubectl rollout undo deployment/nginx Check rollout status kubectl rollout status deployment/nginx
- Securing Your Cluster: RBAC, Network Policies, and Pod Security
Security in Kubernetes is multi-layered. By default, all pods can communicate with each other. Implementing proper security controls is essential for production environments.
Role-Based Access Control (RBAC):
RBAC should follow the principle of least privilege. Use namespaced Roles instead of ClusterRoles when possible, avoid wildcard permissions in production, and regularly audit access.
apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: default name: pod-reader rules: - apiGroups: [""] resources: ["pods"] verbs: ["get", "list", "watch"] apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: namespace: default name: read-pods subjects: - kind: User name: jane apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: pod-reader apiGroup: rbac.authorization.k8s.io
Network Policies:
Start with a deny-all policy and explicitly allow only required traffic.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-all-ingress
spec:
podSelector: {}
policyTypes:
- Ingress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-1ginx
spec:
podSelector:
matchLabels:
app: nginx
ingress:
- from:
- podSelector:
matchLabels:
app: frontend
ports:
- port: 80
Pod Security Standards:
Enforce at least the Baseline level for all namespaces:
apiVersion: v1 kind: Namespace metadata: name: production labels: pod-security.kubernetes.io/enforce: baseline pod-security.kubernetes.io/audit: restricted pod-security.kubernetes.io/warn: restricted
Container Security Context:
Never run containers as root:
securityContext: runAsNonRoot: true runAsUser: 1000 readOnlyRootFilesystem: true allowPrivilegeEscalation: false capabilities: drop: - ALL
5. Managing Persistent Storage: PV, PVC, and StatefulSets
Stateful applications require persistent storage that survives pod restarts. Kubernetes provides PersistentVolumes (PV), PersistentVolumeClaims (PVC), and StorageClasses for this purpose.
StorageClass Definition:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast-ssd provisioner: kubernetes.io/aws-ebs parameters: type: gp3 fsType: ext4
PersistentVolumeClaim:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi storageClassName: fast-ssd
StatefulSet for Stateful Workloads:
StatefulSets are designed for stateful applications and provide stable, unique network identifiers and persistent storage.
apiVersion: apps/v1 kind: StatefulSet metadata: name: mysql spec: serviceName: mysql replicas: 3 selector: matchLabels: app: mysql template: metadata: labels: app: mysql spec: containers: - name: mysql image: mysql:8.0 env: - name: MYSQL_ROOT_PASSWORD valueFrom: secretKeyRef: name: mysql-secret key: root-password volumeMounts: - name: data mountPath: /var/lib/mysql volumeClaimTemplates: - metadata: name: data spec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 10Gi
6. CI/CD Pipeline Integration: Jenkins, Docker, and Kubernetes
Modern DevOps practices demand seamless integration between CI/CD tools and Kubernetes. Jenkins, when combined with Docker and Kubernetes, enables automated builds, testing, and deployments.
Sample Jenkins Pipeline for Kubernetes Deployment:
pipeline {
agent any
environment {
DOCKER_REGISTRY = 'myregistry.azurecr.io'
AKS_CLUSTER = 'my-aks-cluster'
NAMESPACE = 'production'
}
stages {
stage('Build') {
steps {
script {
docker.build("${DOCKER_REGISTRY}/myapp:${env.BUILD_ID}")
}
}
}
stage('Push') {
steps {
script {
docker.withRegistry("https://${DOCKER_REGISTRY}") {
docker.image("${DOCKER_REGISTRY}/myapp:${env.BUILD_ID}").push()
}
}
}
}
stage('Deploy to AKS') {
steps {
script {
sh """
kubectl set image deployment/myapp myapp=${DOCKER_REGISTRY}/myapp:${env.BUILD_ID} -1 ${NAMESPACE}
kubectl rollout status deployment/myapp -1 ${NAMESPACE}
"""
}
}
}
}
}
GitOps with ArgoCD:
For more advanced deployments, GitOps tools like ArgoCD provide declarative, automated synchronization between Git repositories and Kubernetes clusters.
Install ArgoCD kubectl create namespace argocd kubectl apply -1 argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml Access ArgoCD UI kubectl port-forward svc/argocd-server -1 argocd 8080:443 Create application from Git repo argocd app create myapp \ --repo https://github.com/myorg/myapp-config \ --path manifests \ --dest-server https://kubernetes.default.svc \ --dest-1amespace production
What Undercode Say:
- Key Takeaway 1: Kubernetes is not just about containers—it’s about declarative infrastructure, self-healing, and automated scaling. Mastering the control plane components (API Server, etcd, Scheduler, Controller Manager) is fundamental to understanding how Kubernetes makes decisions and maintains desired state.
-
Key Takeaway 2: Security must be baked in from the start, not bolted on. Implement RBAC with least privilege, enforce Network Policies with default-deny, use Pod Security Standards, and always run containers as non-root. Regular audits and runtime protection are essential for production-grade security.
Analysis: The Kubernetes ecosystem continues to evolve rapidly, with eBPF-based networking (Cilium, Calico) gaining traction for improved performance and observability. The shift toward GitOps and declarative CI/CD pipelines represents a fundamental change in how we manage infrastructure—moving from imperative scripts to version-controlled, auditable configurations. As organizations scale their Kubernetes adoption, the focus is shifting from “can we run it?” to “can we run it securely and cost-effectively?” This requires a holistic understanding of networking, storage, security, and automation—exactly what this revision guide aims to provide.
Prediction:
- +1 Kubernetes will continue to dominate container orchestration, with managed services (AKS, EKS, GKE) becoming the default choice for enterprises, reducing operational overhead while providing enterprise-grade security and compliance features.
-
+1 eBPF will become the standard for Kubernetes networking, security, and observability, replacing traditional sidecar proxies and enabling更深层次的 visibility into container workloads.
-
-1 The complexity of Kubernetes security will remain a significant challenge, with misconfigurations and overly permissive RBAC policies continuing to be the leading cause of security incidents in cloud-1ative environments.
-
+1 GitOps and progressive delivery strategies (canary releases, blue-green deployments) will become standard practice, with tools like ArgoCD and Flux achieving mainstream adoption across organizations of all sizes.
-
-1 The skills gap in Kubernetes expertise will persist, creating a premium for certified professionals (CKA, CKAD, CKS) and driving demand for comprehensive training programs that bridge theory and hands-on practice.
▶️ Related Video (78% Match):
https://www.youtube.com/watch?v=1WhBY5SaDwY
🎯Let’s Practice For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
IT/Security Reporter URL:
Reported By: Shivam Raghuvanshi – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


