Kubernetes CKA sample exam question 8 with answer

Question
Create a pod called pod-multi with 2 containers:
Container 1: name container1, image: nginx
Container 2: name container2, image: busybox, command: sleep 4800

Answer
The solution is pretty straightforward. First generate the yaml:

kubectl run pod-multi --image=nginx --dry-run=client -o yaml > pod-multi.yaml
Open pod-multi.yaml file and make it look in this way:
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: pod-multi
  name: pod-multi
spec:
  containers:
  - image: nginx
    name: container1
  - image: busybox
    name: container2
    command: ["sleep", "4800"]
Save and apply:
kubectl apply -f pod-multi.yaml
Verify:
kubectl get po pod-multi
kubectl describe po pod-multi