The following are tasks written as they might appear in the CKAD exam! Remember, the CKAD is notorious for being vague in what specific tools are required to achieve these tasks... so if you'd like a hint about what the task is asking you to do, click the dropdown!
Find which pod in your cluster is consuming the most memory. Write the name of that pod to a file named /tmp/hogpod.txt
HINT
Use the kubectl top pods command against all namespaces in the cluster and find which has the highest memory usage!
Create a pod named ckaddemo which has two containers- each container should do the following:
- first container:
- uses the
nginximage - container is only allowed to consume
300mcpu and512Mimemory.
- uses the
- second container:
- uses the
busybox:1.35.0image - container must be guaranteed
300mcpu. - executes the following command: [ "sh", "-c", "sleep 1h" ]
- guarantee that this container runs as user
1000test this with a
kubectl exec -it ckaddemo -- shand run awhoamicommand.
- uses the
HINT
- container is only allowed to consume
300mcpu and512Mimemory <-- add a LIMIT - command: [ "sh", "-c", "sleep 1h" ]
- container must be guaranteed
300mcpu. <-- add a REQUEST - guarantee that this container runs as user
1000<-- add a SECURITY CONTEXT
Click here!
apiVersion: v1
kind: Pod
metadata:
name: ckaddemo
spec:
containers:
- name: nginx1
image: nginx
resources:
limits:
cpu: "300m"
memory: "512Mi"
- name: nginx2
image: busybox:1.35.0
resources:
requests:
cpu: "300m"
command: [ "sh", "-c", "sleep 1h" ]
securityContext:
runAsUser: 1000