This repository is designed for practical hands-on practice for the Certified Kubernetes Administrator (CKA) exam. It contains YAML files, scripts, and notes covering all key domains. Use this README as a guide for your study workflow.
cka-practice/
├── README.md # This guide
├── pods/ # Pod creation and management exercises
├── deployments/ # Deployments, ReplicaSets
├── services/ # Services (ClusterIP, NodePort, LoadBalancer)
├── configmaps-secrets/ # ConfigMaps & Secrets practice
├── volumes-storage/ # PersistentVolumes, PersistentVolumeClaims, StorageClasses
├── networking/ # NetworkPolicies, Ingress
├── rbac/ # Users, Roles, RoleBindings
├── troubleshooting/ # Debugging & cluster maintenance exercises
└── manifests/ # Utility YAMLs for quick testing
kubectl run <pod-name> --image=<image-name>:<version> [--labels=key=value]
kubectl run nginx-pod --image=nginx:latest --labels=app=web- Labels optional
- Pods created this way aren’t managed by controllers (no scaling/replication)
kubectl create -f <file.yaml>
kubectl apply -f <file.yaml>- Example YAML:
pods/createpod.yaml - Edit live pod:
kubectl edit pod <pod-name>- Generate YAML from command (dry-run):
kubectl run nginx-pod --image=nginx --dry-run=client -o yaml > podnew.yaml- Export existing pod YAML:
kubectl get pod nginx-pod -o yaml > getpod.yamlkubectl get pods
kubectl get pods -o wide
kubectl describe pod <pod-name>
kubectl exec -it <pod-name> -- sh
kubectl delete pod <pod-name>
kubectl delete pods --all- Create a deployment declaratively:
kubectl create -f deployments/nginx-deployment.yaml
kubectl apply -f deployments/nginx-deployment.yaml- Scale:
kubectl scale deployment nginx-deployment --replicas=3- Rollout status & history:
kubectl rollout status deployment/nginx-deployment
kubectl rollout history deployment/nginx-deployment
kubectl rollout undo deployment/nginx-deployment- Expose pods or deployments:
kubectl expose pod nginx-pod --type=NodePort --port=80
kubectl expose deployment nginx-deployment --type=ClusterIP --port=80- Check services:
kubectl get svc
kubectl describe svc <service-name>- Network policies: create restrictive ingress/egress rules in
networking/folder
- Create ConfigMap:
kubectl create configmap app-config --from-file=config.properties- Create Secret:
kubectl create secret generic db-secret --from-literal=password='mypassword'- Mount ConfigMap/Secret in Pod via
spec.containers[].envFromorvolumeMounts
- PersistentVolume (PV) + PersistentVolumeClaim (PVC)
kubectl create -f volumes-storage/pv.yaml
kubectl create -f volumes-storage/pvc.yaml
kubectl get pv,pvc- StorageClass usage for dynamic provisioning
- Create Roles and RoleBindings:
kubectl create -f rbac/role.yaml
kubectl create -f rbac/rolebinding.yaml
kubectl auth can-i <action> <resource> --as <user>- Practice
ClusterRoleandClusterRoleBinding
- Check node status:
kubectl get nodes
kubectl describe node <node-name>- Check pod logs:
kubectl logs <pod-name>
kubectl logs -f <pod-name>- Access cluster shell:
kubectl exec -it <pod-name> -- /bin/sh- Hands-on > Theory — always create, delete, edit, scale resources manually.
- Use dry-run & YAML generation for practice:
kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml- Namespaces — practice switching and creating namespaces:
kubectl create namespace test
kubectl get pods -n test- Shortcuts:
kubectl get all
kubectl get pods -o wide
kubectl delete pods --all- Backup YAMLs — save working configurations to reuse during practice.
This README serves as the central guide for your CKA repo, and each folder contains examples & exercises to reinforce learning.