Linux Foundation Certified Kubernetes Administrator CKA Exam Questions

Page: 1 / 14
Total 83 questions
Question 1

SIMULATION

Create a Kubernetes secret as follows:

Name: super-secret

password: bob

Create a pod named pod-secrets-via-file, using the redis Image, which mounts a secret named super-secret at /secrets.

Create a second pod named pod-secrets-via-env, using the redis Image, which exports password as CONFIDENTIAL



Answer : A

solution


Question 2

SIMULATION

Score:7%

Context

An existing Pod needs to be integrated into the Kubernetes built-in logging architecture (e. g. kubectl logs). Adding a streaming sidecar container is a good and common way to accomplish this requirement.

Task

Add a sidecar container named sidecar, using the busybox Image, to the existing Pod big-corp-app. The new sidecar container has to run the following command:

/bin/sh -c tail -n+1 -f /va r/log/big-corp-app.log

Use a Volume, mounted at /var/log, to make the log file big-corp-app.log available to the sidecar container.



Answer : A

Solution:

#

kubectl get pod big-corp-app -o yaml

#

apiVersion: v1

kind: Pod

metadata:

name: big-corp-app

spec:

containers:

- name: big-corp-app

image: busybox

args:

- /bin/sh

- -c

- >

i=0;

while true;

do

echo '$(date) INFO $i' >> /var/log/big-corp-app.log;

i=$((i+1));

sleep 1;

done

volumeMounts:

- name: logs

mountPath: /var/log

- name: count-log-1

image: busybox

args: [/bin/sh, -c, 'tail -n+1 -f /var/log/big-corp-app.log']

volumeMounts:

- name: logs

mountPath: /var/log

volumes:

- name: logs

emptyDir: {

}

#

kubectl logs big-corp-app -c count-log-1


Question 3

SIMULATION

Score: 4%

Task

Check to see how many nodes are ready schedulable (not including nodes tainted NoSchedule ) and write the number to /opt/KUSC00402/kusc00402.txt.



Answer : A

Solution:

kubectl describe nodes | grep ready|wc -l

kubectl describe nodes | grep -i taint | grep -i noschedule |wc -l

echo 3 > /opt/KUSC00402/kusc00402.txt

#

kubectl get node | grep -i ready |wc -l

# taintsnoSchedule

kubectl describe nodes | grep -i taints | grep -i noschedule |wc -l

#

echo 2 > /opt/KUSC00402/kusc00402.txt


Question 4

SIMULATION

From the pod label name=cpu-utilizer, find pods running high CPU workloads and

write the name of the pod consuming most CPU to the file /opt/KUTR00102/KUTR00102.txt (which already exists).



Answer : A

solution


Question 5

SIMULATION

Check the image version in pod without the describe command



Answer : A

kubectl get po nginx -o

jsonpath='{.spec.containers[].image}{'\n'}'


Question 6

SIMULATION

List all the pods showing name and namespace with a json path expression



Answer : A

kubectl get pods -o=jsonpath='{.items[*]['metadata.name',

'metadata.namespace']}'


Question 7

SIMULATION

Score: 4%

Context

You have been asked to create a new ClusterRole for a deployment pipeline and bind it to a specific ServiceAccount scoped to a specific namespace.

Task

Create a new ClusterRole named deployment-clusterrole, which only allows to create the following resource types:

* Deployment

* StatefulSet

* DaemonSet

Create a new ServiceAccount named cicd-token in the existing namespace app-team1.

Bind the new ClusterRole deployment-clusterrole lo the new ServiceAccount cicd-token , limited to the namespace app-team1.



Answer : A

Solution:

Task should be complete on node k8s -1 master, 2 worker for this connect use command

[student@node-1] > ssh k8s

kubectl create clusterrole deployment-clusterrole --verb=create --resource=deployments,statefulsets,daemonsets

kubectl create serviceaccount cicd-token --namespace=app-team1

kubectl create rolebinding deployment-clusterrole --clusterrole=deployment-clusterrole --serviceaccount=default:cicd-token --namespace=app-team1


Page:    1 / 14   
Total 83 questions