Certified Kubernetes Administrator (CKA) Practice Questions
1. Create a pod named `nginx-pod` using the `nginx` image.
Answer: kubectl run nginx-pod --image=nginx
2. Create a deployment named `web-deploy` with 3 replicas using the `nginx:1.14.2` image.
Answer: kubectl create deployment web-deploy --image=nginx:1.14.2 --replicas=3
3. Expose the `web-deploy` deployment on port 80 using a NodePort service.
Answer: kubectl expose deployment web-deploy --type=NodePort --port=80
4. Get all pods in all namespaces.
Answer: kubectl get pods --all-namespaces
5. Create a ConfigMap named `app-config` with a key `ENV=prod`.
Answer: kubectl create configmap app-config --from-literal=ENV=prod
6. Create a secret named `db-secret` with key `password=admin123`.
Answer: kubectl create secret generic db-secret --from-literal=password=admin123
7. Display the logs for a pod named `nginx-pod`.
Answer: kubectl logs nginx-pod
8. Drain a node named `worker-node1` for maintenance.
Answer: kubectl drain worker-node1 --ignore-daemonsets
9. Create a pod `busybox` that runs the command `sleep 3600`.
Answer: kubectl run busybox --image=busybox --command -- sleep 3600
10. View the details of a deployment named `web-deploy`.
Answer: kubectl describe deployment web-deploy