Kubernetes CKA sample exam question 1 with answer

Question
Create a new pod called admin-pod with image busybox.
Allow the pod to be able to set system time.
The container should sleep for 3200 seconds.

Answer
Generate a pod definition file:

kubectl run admin-pod --image=busybox --command sleep 3200 --dry-run=client -o yaml > admin-pod.yaml
Open and modify the admin-pod.yaml to look like this:
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: admin-pod
  name: admin-pod
spec:
  containers:
  - command:
    - sleep
    - "3200"
    image: busybox
    name: admin-pod
    securityContext:
      capabilities:
        add: ["SYS_TIME"]
Run apply on definition file and check the pod details with describe.