ExamGecko

Linux Foundation CKA Practice Test - Questions Answers, Page 7

Question list
Search
Search

Score:7%

Task

Create a new PersistentVolumeClaim

• Name: pv-volume

• Class: csi-hostpath-sc

• Capacity: 10Mi

Create a new Pod which mounts the PersistentVolumeClaim as a volume:

• Name: web-server

• Image: nginx

• Mount path: /usr/share/nginx/html

Configure the new Pod to have ReadWriteOnce access on the volume.

Finally, using kubectl edit or kubectl patch expand the PersistentVolumeClaim to a capacity of 70Mi and record that change.

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:

vi pvc.yaml

storageclass pvc

apiVersion: v1

kind: PersistentVolumeClaim

metadata:

name: pv-volume

spec:

accessModes:

- ReadWriteOnce

volumeMode: Filesystem

resources:

requests:

storage: 10Mi

storageClassName: csi-hostpath-sc

# vi pod-pvc.yaml

apiVersion: v1

kind: Pod

metadata:

name: web-server

spec:

containers:

- name: web-server

image: nginx

volumeMounts:

- mountPath: "/usr/share/nginx/html"

name: my-volume

volumes:

- name: my-volume

persistentVolumeClaim:

claimName: pv-volume

# craete

kubectl create -f pod-pvc.yaml

#edit

kubectl edit pvc pv-volume --record

Score: 5%

Task

Monitor the logs of pod bar and:

• Extract log lines corresponding to error file-not-found

• Write them to /opt/KUTR00101/bar

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:

kubectl logs bar | grep 'unable-to-access-website' > /opt/KUTR00101/bar

cat /opt/KUTR00101/bar

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.

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:

# kubectl get pod big-corp-app -

o

yaml

#a

piVersion: 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

Score: 5%

Task

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/KUTR00401/KUTR00401.txt (which already exists).

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:

kubectl top -l name=cpu-user -A

echo 'pod name' >> /opt/KUT00401/KUT00401.txt

Score: 13%

Task

A Kubernetes worker node, named wk8s-node-0 is in state NotReady. Investigate why this is the case, and perform any appropriate steps to bring the node to a Ready state, ensuring that any changes are made permanent.

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:

sudo -i

systemctl status kubelet

systemctl start kubelet

systemctl enable kubelet

Task Weight: 4%

Task

Scale the deployment webserver to 3 pods.

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:

Task Weight: 4%

Task

Schedule a Pod as follows:

• Name: kucc1

• App Containers: 2

• Container Name/Images:

o nginx

o consul

A.
See the solution below.
A.
See the solution below.
Answers
Suggested answer: A

Explanation:

Solution:


Total 67 questions
Go to page: of 7