Kubernetes CKA sample exam question 26 with answer

Question
Create a multi-container pod multi-pod in development namespace using images: nginx and redis

Answer
Check if namespace development is present and create it if not:

kubectl get ns
kubectl create ns development
Generate manifest:
kubectl run multi-pod --image=nginx --dry-run=client -o yaml
Adjust it in the following way:
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: multi-pod
  name: multi-pod
  namespace: development
spec:
  containers:
  - image: nginx
    name: nginx
  - image: redis
    name: redis
Apply and check:
kubectl apply -f pod.yaml
kubectl -n development get po
kubectl -n development describe po multi-pod