Limited-Time Offer: Enjoy 50% Savings! Ends in 00h 00m 00s Coupon code: 50OFF
Skip to content

Free Linux Foundation Certified Kubernetes Application Developer CKAD Exam Questions

Page: 1 / 8 Total 48 questions

Want more questions? Get Premium Access.

Question 1

SIMULATION

Task:

Modify the existing Deployment named broker-deployment running in namespace quetzal so that its containers.

1) Run with user ID 30000 and

2) Privilege escalation is forbidden

The broker-deployment is manifest file can be found at:

Correct Answer: A. See the solution below
Explanation:

Solution:


Question 2

SIMULATION

Task:

Create a Deployment named expose in the existing ckad00014 namespace running 6 replicas of a Pod. Specify a single container using the ifccncf/nginx: 1.13.7 image

Add an environment variable named NGINX_PORT with the value 8001 to the container then expose port 8001

Correct Answer: A. See the solution below
Explanation:

Solution:


Question 3

SIMULATION

Context

You are asked to set resource requests and limits for a running workload to ensure fair resource management.

''Do not delete the existing Deployment . Failure to do so will result in a reduced score.''

Next, ensure that the total amount of resources in the namespace matches the maximum resources the Pods from the nginx-resources Deployment can request.

Failure to do so will result in the updated Deployment failing to roll out successfully.

Correct Answer: A. See the Explanation below for complete solution
Explanation:

Below are the exact steps/commands you can run.

1) Locate the Deployment and its namespace

kubectl get deploy -A | grep nginx-resources

You should see output like:

<namespace> nginx-resources ...

Set a variable (replace <NS> with what you see):

NS=<NS>

Confirm replicas:

kubectl -n $NS get deploy nginx-resources -o jsonpath='{.spec.replicas}{'\n'}'

2) Check if there is a ResourceQuota in that namespace

kubectl -n $NS get resourcequota

kubectl -n $NS describe resourcequota

If there is a quota, note these fields (common ones):

requests.cpu

requests.memory

limits.cpu

limits.memory

3) Decide requests/limits for the Deployment (example values)

If the question (in your environment) provides specific values, use those.

If it doesn't, a typical safe pair is:

requests: cpu: 100m, memory: 128Mi

limits: cpu: 200m, memory: 256Mi

I'll proceed with these example values. If your lab specifies different numbers, just swap them in.

4) Update the existing Deployment (DO NOT DELETE)

Option A (fastest): kubectl set resources

Assuming the container name is the first container (we'll detect it):

kubectl -n $NS get deploy nginx-resources -o jsonpath='{.spec.template.spec.containers[*].name}{'\n'}'

If it prints a single container name, set it like this:

kubectl -n $NS set resources deploy nginx-resources \

--requests=cpu=100m,memory=128Mi \

--limits=cpu=200m,memory=256Mi

Verify the Deployment now has resources

kubectl -n $NS get deploy nginx-resources -o jsonpath='{.spec.template.spec.containers[0].resources}{'\n'}'

5) Compute the total resources requested by the Deployment

Get replicas:

REPLICAS=$(kubectl -n $NS get deploy nginx-resources -o jsonpath='{.spec.replicas}')

echo $REPLICAS

6) Ensure the namespace quota matches (or exceeds) those totals

This is the part the question warns about: if the quota is too low, the Deployment update will fail to roll out.

6.1 If a ResourceQuota already exists

Patch it to allow at least the totals you calculated.

First, identify quota name:

RQ=$(kubectl -n $NS get resourcequota -o jsonpath='{.items[0].metadata.name}')

echo $RQ

Then patch (example: replicas=2 requests.cpu=200m, requests.memory=256Mi):

kubectl -n $NS patch resourcequota $RQ --type='merge' -p '{

'spec': {

'hard': {

'requests.cpu': '200m',

'requests.memory': '256Mi',

'limits.cpu': '400m',

'limits.memory': '512Mi'

}

}

}'

Adjust those numbers to your replicas request, and replicas limit (if your quota also enforces limits).

6.2 If there is NO ResourceQuota

Create one that matches the Deployment max request totals.

Example for replicas=2 with our sample requests/limits:

cat <<EOF | kubectl apply -n $NS -f -

apiVersion: v1

kind: ResourceQuota

metadata:

name: nginx-resources-quota

spec:

hard:

requests.cpu: '200m'

requests.memory: '256Mi'

limits.cpu: '400m'

limits.memory: '512Mi'

EOF

7) Verify rollout succeeds

kubectl -n $NS rollout status deploy nginx-resources

kubectl -n $NS get pods

Verify the running pods actually have the requests/limits:

kubectl -n $NS get pod -l app=nginx-resources -o jsonpath='{range .items[*]}{.metadata.name}{' '}{.spec.containers[0].resources}{'\n'}{end}'

(If the label selector app=nginx-resources doesn't exist, just pick a pod name from kubectl get pods and run:)

kubectl -n $NS describe pod | sed -n '/Limits:/,/Requests:/p'

Common reasons this fails (and the fix)

Rollout stuck / pods pending with ''exceeded quota''

Check:

kubectl -n $NS describe pod

kubectl -n $NS describe resourcequota

Fix: increase ResourceQuota hard values to match required totals.

You set requests higher than quota allows

Fix: either reduce requests or raise quota.

kubectl get deploy -A | grep nginx-resources

kubectl -n <NS> get deploy nginx-resources -o jsonpath='{.spec.replicas}{'\n'}{.spec.template.spec.containers[0].name}{'\n'}'

kubectl -n <NS> describe resourcequota


Question 4

SIMULATION

Task

A deployment is falling on the cluster due to an incorrect image being specified. Locate the deployment, and fix the problem.

Correct Answer: A. See the solution below
Explanation:

create deploy hello-deploy --image=nginx --dry-run=client -o yaml > hello-deploy.yaml

Update deployment image tonginx:1.17.4: kubectl set image deploy/hello-deploy nginx=nginx:1.17.4


Question 5

SIMULATION

Task:

1) First update the Deployment cka00017-deployment in the ckad00017 namespace:

*To run 2 replicas of the pod

*Add the following label on the pod:

Role userUI

2) Next, Create a NodePort Service named cherry in the ckad00017 nmespace exposing the ckad00017-deployment Deployment on TCP port 8888

Correct Answer: A. See the solution below
Explanation:

Solution:


Question 6

SIMULATION

Task

You are required to create a pod that requests a certain amount of CPU and memory, so it gets scheduled to-a node that has those resources available.

* Create a pod named nginx-resources in the pod-resources namespace that requests a minimum of 200m CPU and 1Gi memory for its container

* The pod should use the nginx image

* The pod-resources namespace has already been created

Correct Answer: A. See the solution below
Explanation:

Solution: