CKA_Exam_Level_Practice_Questions
CKA_Exam_Level_Practice_Questions
1. Create a pod called `nginx-secure` that uses the `nginx` image and runs in the `restricted`
namespace.
2. Create a deployment called `redis-deploy` with 2 replicas using the `redis:6.0` image and expose
3. Set a resource limit of 200m CPU and 256Mi memory for a container in pod `nginx-limited` using
4. Create a pod `nginx-probe` with readiness and liveness HTTP probes on port 80.
6. Create a persistent volume called `pv-data` of size 1Gi using hostPath `/mnt/data`.
`key=dedicated,value=frontend:NoSchedule`.
11. Create a Job that runs `echo Hello CKA` and exits.
13. Configure a network policy to allow ingress to pod label app=web only from pods with label
access=true.
15. Upgrade a cluster node's kubelet configuration to use a custom `--cgroup-driver=systemd` flag.
16. Create a pod that mounts a ConfigMap with key `ENV=prod` as an environment variable.
20. Create a Horizontal Pod Autoscaler for `web-deploy` between 1 and 5 replicas at 80% CPU
target.
21. Create a CronJob that runs every 5 minutes and echoes `Hi`.
26. Create a pod `curlpod` and use it to test service `web-svc` on port 80.
27. Create a pod with init containers that sleeps 10s before starting main container.
28. Create a deployment with anti-affinity rules to spread pods across nodes.
29. Create a pod that writes to a file every 30 seconds and test log rotation.
1. Create a pod called `nginx-secure` that uses the `nginx` image and runs in the `restricted`
namespace.
Answer:
2. Create a deployment called `redis-deploy` with 2 replicas using the `redis:6.0` image and expose
Answer:
3. Set a resource limit of 200m CPU and 256Mi memory for a container in pod `nginx-limited` using
Answer:
Create a YAML file with `resources.limits` section and apply using kubectl apply -f file.yaml
4. Create a pod `nginx-probe` with readiness and liveness HTTP probes on port 80.
Answer:
Define the pod spec with `readinessProbe` and `livenessProbe` using HTTP GET on port 80.
Answer:
6. Create a persistent volume called `pv-data` of size 1Gi using hostPath `/mnt/data`.
Answer:
Define a PersistentVolume YAML with capacity 1Gi and hostPath `/mnt/data`, then apply it.
7. Create a PersistentVolumeClaim for `pv-data` and mount it in a pod running busybox.
Answer:
Create a PVC and a pod that mounts the claim, using a shared volumeMounts path.
Answer:
`key=dedicated,value=frontend:NoSchedule`.
Answer:
Answer:
11. Create a Job that runs `echo Hello CKA` and exits.
Answer:
Define a Job YAML that runs busybox with command `echo Hello CKA`.
Answer:
13. Configure a network policy to allow ingress to pod label app=web only from pods with label
access=true.
Answer:
Define a NetworkPolicy with podSelector app=web and from: podSelector matchLabels access=true.
15. Upgrade a cluster node's kubelet configuration to use a custom `--cgroup-driver=systemd` flag.
Answer:
16. Create a pod that mounts a ConfigMap with key `ENV=prod` as an environment variable.
Answer:
Answer:
Answer:
--cert --key
Answer:
Stop etcd, use `etcdctl snapshot restore`, then point etcd to the restored data dir.
20. Create a Horizontal Pod Autoscaler for `web-deploy` between 1 and 5 replicas at 80% CPU
target.
Answer:
21. Create a CronJob that runs every 5 minutes and echoes `Hi`.
Answer:
kubectl create cronjob hi-job --schedule="*/5 * * * *" --image=busybox -- echo Hi
Answer:
Create Role with list pods and bind it to `appuser` using RoleBinding.
Answer:
kubectl api-resources
Answer:
Answer:
26. Create a pod `curlpod` and use it to test service `web-svc` on port 80.
Answer:
27. Create a pod with init containers that sleeps 10s before starting main container.
Answer:
Define initContainers section with sleep 10, then normal containers start.
28. Create a deployment with anti-affinity rules to spread pods across nodes.
Answer:
29. Create a pod that writes to a file every 30 seconds and test log rotation.
Answer:
Pod uses busybox and writes to file in a loop. Set up logrotate manually.
30. Debug why a pod `nginx-pod` is not starting.
Answer: