Free CKA Exam Braindumps
Certified Kubernetes Administrator Questions 31–35 (page: 8)

Updated On: 10-Feb-2026

Create a Pod with three busy box containers with commands "ls; sleep 3600;", "echo Hello World; sleep 3600;" and "echo this is the third container; sleep 3600" respectively and check the status

  1. Solution:

    // first create single container pod with dry run flag kubectl run busybox --image=busybox --restart=Always --dry-run -o yaml -- bin/sh -c "sleep 3600; ls" > multi-container.yaml // edit the pod to following yaml and create it
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: busybox
    name: busybox
    spec:
    containers:
    - args:
    - bin/sh
    - -c
    - ls; sleep 3600
    image: busybox
    name: busybox-container-1
    - args:
    - bin/sh
    - -c
    - echo Hello world; sleep 3600
    image: busybox
    name: busybox-container-2
    - args:
    - bin/sh
    - -c
    - echo this is third container; sleep 3600
    image: busybox
    name: busybox-container-3
    restartPolicy: Always
    // Verify
    Kubectl get pods

Answer(s): A



Check logs of each container that "busyboxpod-{1,2,3}"

  1. Solution:

    kubectl logs busybox -c busybox-container-1
    kubectl logs busybox -c busybox-container-2
    kubectl logs busybox -c busybox-container-3

Answer(s): A



Create a Pod with main container busybox and which executes this "while true; do echo `Hi I am from Main container' >> /var/log/index.html; sleep 5; done" and with sidecar container with nginx image which exposes on port 80. Use emptyDir Volume and mount this volume on path /var/log for busybox and on path /usr/share/nginx/html for nginx container. Verify both containers are running.

  1. Solution:

    // create an initial yaml file with this
    kubectl run multi-cont-pod --image=busbox --restart=Never -- dry-run -o yaml > multi-container.yaml
    // edit the yml as below and create it
    kubectl create -f multi-container.yaml
    vim multi-container.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: multi-cont-pod
    name: multi-cont-pod
    spec:
    volumes:
    - name: var-logs
    emptyDir: {}
    containers:
    - image: busybox
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo 'Hi I am from Main container' >> /var/log/index.html; sleep 5;done"]
    name: main-container
    volumeMounts:
    - name: var-logs
    mountPath: /var/log
    - image: nginx
    name: sidecar-container
    ports:
    - containerPort: 80
    volumeMounts:
    - name: var-logs


    mountPath: /usr/share/nginx/html
    restartPolicy: Never
    // Create Pod
    kubectl apply -f multi-container.yaml
    //Verify
    kubectl get pods

Answer(s): A



Exec into both containers and verify that main.txt exist and

  1. Solution:
    NEED TO WRITE ANSWER FOR THIS

Answer(s): A



Create an nginx pod and set an env value as 'var1=val1'. Check the env value existence within the pod

  1. Solution:

    kubectl run nginx --image=nginx --restart=Never --env=var1=val1 # then
    kubectl exec -it nginx -- env
    # or
    kubectl exec -it nginx -- sh -c 'echo $var1'
    # or
    kubectl describe po nginx | grep val1
    # or
    kubectl run nginx --restart=Never --image=nginx --env=var1=val1 -it --rm ­ env

Answer(s): A



Viewing page 8 of 26
Viewing questions 36 - 40 out of 122 questions


Post your Comments and Discuss Linux Foundation CKA exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!