Skip to content

Latest commit

 

History

History
68 lines (55 loc) · 2.04 KB

File metadata and controls

68 lines (55 loc) · 2.04 KB

Morning Warmup!

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!

Task 1

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!

Task 2

Create a pod named ckaddemo which has two containers- each container should do the following:

  • first container:
    • uses the nginx image
    • container is only allowed to consume 300m cpu and 512Mi memory.
  • second container:
    • uses the busybox:1.35.0 image
    • container must be guaranteed 300m cpu.
    • executes the following command: [ "sh", "-c", "sleep 1h" ]
    • guarantee that this container runs as user 1000

      test this with a kubectl exec -it ckaddemo -- sh and run a whoami command.

HINT
  • container is only allowed to consume 300m cpu and 512Mi memory <-- add a LIMIT
  • command: [ "sh", "-c", "sleep 1h" ]
  • container must be guaranteed 300m cpu. <-- add a REQUEST
  • guarantee that this container runs as user 1000 <-- add a SECURITY CONTEXT

SOLUTION:

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