Get New 2024 Linux Foundation exam CKA Dumps Bundle On flat Updated Dumps!
Full CKA Practice Test and 68 unique questions with explanations waiting just for you, get it now!
NEW QUESTION # 11
Create a deployment as follows:
Name: nginx-random
Exposed via a service nginx-random
Ensure that the service & pod are accessible via their respective DNS records The container(s) within any pod(s) running as a part of this deployment should use the nginx Image Next, use the utility nslookup to look up the DNS records of the service & pod and write the output to /opt/KUNW00601/service.dns and /opt/KUNW00601/pod.dns respectively.
Answer:
Explanation:
Solution:


NEW QUESTION # 12
Task Weight: 4%
Task
Schedule a Pod as follows:
* Name: kucc1
* App Containers: 2
* Container Name/Images:
o nginx
o consul
Answer:
Explanation:
Solution:


NEW QUESTION # 13
Score: 4%
Task
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.
Answer:
Explanation:
SOLUTION:
[student@node-1] > ssh ek8s
kubectl cordon ek8s-node-1
kubectl drain ek8s-node-1 --delete-local-data --ignore-daemonsets --force
NEW QUESTION # 14
Create an nginx pod and list the pod with different levels of verbosity
- A. // create a pod
kubectl run nginx --image=nginx --restart=Never --port=80
// List the pod with different verbosity
kubectl get po nginx --v=7
kubectl get po nginx --v=6
kubectl get po nginx --v=9 - B. // create a pod
kubectl run nginx --image=nginx --restart=Never --port=80
// List the pod with different verbosity
kubectl get po nginx --v=7
kubectl get po nginx --v=8
kubectl get po nginx --v=9
Answer: B
NEW QUESTION # 15
Scale the deployment webserver to
Answer:
Explanation:
See the solution below.
Explanation
solution
NEW QUESTION # 16
Create a deployment as follows:
* Name:nginx-random
* Exposed via a servicenginx-random
* Ensure that the service & podare accessible via theirrespective DNS records
* The container(s) within anypod(s) running as a part of thisdeployment should use thenginxImage Next, use the utilitynslookupto lookup the DNS records of the service &pod and write the output to
/opt/KUNW00601/service.dnsand/opt/KUNW00601/pod.dnsrespectively.
Answer:
Explanation:
See the solution below.
Explanation
Solution:


NEW QUESTION # 17
Deployment
a. Create a deployment of webapp with image nginx:1.17.1 with
container port 80 and verify the image version
- A. // Create initial YAML file with -dry-run option
kubectl create deploy webapp --image=nginx:1.17.1 --dryrun=client -o yaml > webapp.yaml vim webapp.yaml apiVersion: apps/v1 kind: Deployment metadata:
labels:
app: webapp
name: webapp
spec: replicas: 1 containers: - image: nginx:1.17.1 name: nginx kubectl create -f webapp.yaml -record=true //Verify Image Version kubectl describe deploy webapp | grep -i "Image" Using JsonPath kubectl get deploy -o=jsonpath='{range.items [*]}{.[*]} {.metadata.name}{"\t"}{.spec.template.spec.containers[*].i mage}{"\n"}' - B. // Create initial YAML file with -dry-run option
kubectl create deploy webapp --image=nginx:1.17.1 --dryrun=client -o yaml > webapp.yaml vim webapp.yaml apiVersion: apps/v1 kind: Deployment metadata:
labels:
app: webapp
name: webapp
spec: replicas: 1 selector: matchLabels: app: webapp template: metadata: labels: app: webapp spec: containers: - image: nginx:1.17.1 name: nginx kubectl create -f webapp.yaml -record=true //Verify Image Version kubectl describe deploy webapp | grep -i "Image" Using JsonPath kubectl get deploy -o=jsonpath='{range.items [*]}{.[*]} {.metadata.name}{"\t"}{.spec.template.spec.containers[*].i mage}{"\n"}'
Answer: B
NEW QUESTION # 18
Create a nginx pod with label env=test in engineering namespace
Answer:
Explanation:
See the solution below.
Explanation
kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o yaml > nginx-pod.yaml kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o yaml | kubectl create -nengineering-f - YAML File:
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: engineering
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Never
kubectl create -f nginx-pod.yaml
NEW QUESTION # 19
Create an nginx pod which loads the secret as environment variables
- A. // create a yml file
kubectl run nginx --image=nginx --restart=Never --dry-run -o
yaml > nginx.yml
// add env section below and create
vim nginx.yaml
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
envFrom:
- secretRef:
name: my-secret
restartPolicy: Never
kubectl apply -f nginx.yaml
//verify
kubectl exec -it nginx - env - B. // create a yml file
kubectl run nginx --image=nginx --restart=Never --dry-run -o
yaml > nginx.yml
// add env section below and create
vim nginx.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
envFrom:
- secretRef:
name: my-secret
restartPolicy: Never
kubectl apply -f nginx.yaml
//verify
kubectl exec -it nginx - env
Answer: B
NEW QUESTION # 20
Create an nginx pod which reads username as the environment variable
- A. // create a yml file
kubectl run nginx --image=nginx --restart=Never --dry-run -o
yaml > nginx.yml
// add env section below and create
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
env:
- name: USER_NAME
restartPolicy: Never
kubectl create -f nginx.yml
//Verify
kubectl exec -it nginx - env - B. // create a yml file
kubectl run nginx --image=nginx --restart=Never --dry-run -o
yaml > nginx.yml
// add env section below and create
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
env:
- name: USER_NAME
valueFrom:
secretKeyRef:
name: my-secret
key: username
restartPolicy: Never
kubectl create -f nginx.yml
//Verify
kubectl exec -it nginx - env
Answer: B
NEW QUESTION # 21
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
Answer:
Explanation:
Solution:
kubectl logs bar | grep 'unable-to-access-website' > /opt/KUTR00101/bar cat /opt/KUTR00101/bar
NEW QUESTION # 22
Create a busybox pod and add "sleep 3600" command
Answer:
Explanation:
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c
"sleep 3600"
NEW QUESTION # 23
List all the pods showing name and namespace with a json path expression
Answer:
Explanation:
kubectl get pods -o=jsonpath="{.items[*]['metadata.name', 'metadata.namespace']}"
NEW QUESTION # 24
Create a pod that echo "hello world" and then exists. Have the pod deleted automatically when it's completed
Answer:
Explanation:
See the solution below.
Explanation
kubectl run busybox --image=busybox -it --rm --restart=Never --
/bin/sh -c 'echo hello world'
kubectl get po # You shouldn't see pod with the name "busybox"
NEW QUESTION # 25
Create a pod as follows:
* Name: non-persistent-redis
* container Image: redis
* Volume with name: cache-control
* Mount path: /data/redis
The pod should launch in the staging namespace and the volume must not be persistent.
Answer:
Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 26
Create a snapshot of theetcdinstance running at , saving thesnapshot to the file path
/srv/data/etcd-snapshot.db.
The following TLScertificates/key are suppliedfor connecting to the server withetcdctl:
* CA certificate:/opt/KUCM00302/ca.crt
* Client certificate:/opt/KUCM00302/etcd-client.crt
* Client key:Topt/KUCM00302/etcd-client.key
Answer:
Explanation:
See the solution below.
Explanation
solution
NEW QUESTION # 27
Get list of persistent volumes and persistent volume claim in the cluster
Answer:
Explanation:
kubectl get pv kubectl get pvc
NEW QUESTION # 28
Score: 7%
Task
Reconfigure the existing deployment front-end and add a port specification named http exposing port 80/tcp of the existing container nginx.
Create a new service named front-end-svc exposing the container port http.
Configure the new service to also expose the individual Pods via a NodePort on the nodes on which they are scheduled.
Answer:
Explanation:
See the solution below.
Explanation
Solution:
kubectl get deploy front-end
kubectl edit deploy front-end -o yaml
#port specification named http
#service.yaml
apiVersion: v1
kind: Service
metadata:
name: front-end-svc
labels:
app: nginx
spec:
ports:
- port: 80
protocol: tcp
name: http
selector:
app: nginx
type: NodePort
# kubectl create -f service.yaml
# kubectl get svc
# port specification named http
kubectl expose deployment front-end --name=front-end-svc --port=80 --tarport=80 --type=NodePort
NEW QUESTION # 29
Get list of all the pods showing name and namespace with a jsonpath expression.
Answer:
Explanation:
See the solution below.
Explanation
kubectl get pods -o=jsonpath="{.items[*]['metadata.name'
, 'metadata.namespace']}"
NEW QUESTION # 30
Create a ETCD backup of kubernetes cluster
Note : You don't need to memorize command, refer -
https://kubernetes.io/docs/tasks/administer-cluster/configureupgrade-etcd/ during exam
- A. ETCDCTL_API=3 etcdctl --endpoints=[ENDPOINT] --cacert=[CA CERT]
--cert=[ETCD SERVER CERT] --key=[ETCD SERVER KEY] snapshot save
[BACKUP FILE NAME]
In exam, cluster setup is done with kubeadm , this means ETCD
used by the kubernetes cluster is coming from static pod.
kubectl get pod -n kube-system
kubectl describe pod etcd-master -n kube-system
You can locate the information on
endpoint: - advertise-client-urls=https://172.16.0.18:2379
ca certificate: - trusted-cafile=/etc/kubernetes/pki/etcd/ca.crt
server certificate : - certfile=/etc/kubernetes/pki/etcd/server.crt
key: - key-file=/etc/kubernetes/pki/etcd/server.key
To Create backup
export ETCDCTL_API=3
(or)
ETCDCTL_API=3 etcdctl ETCDCTL_API=3 etcdctl --
endpoints=https://172.17.0.15:2379 --
key=/etc/kubernetes/pki/etcd/server.key snapshot save etcdsnapshot.db
//Verify
ETCDCTL_API=3 etcdctl --write-out=table snapshot status
snapshot.db - B. ETCDCTL_API=3 etcdctl --endpoints=[ENDPOINT] --cacert=[CA CERT]
--cert=[ETCD SERVER CERT] --key=[ETCD SERVER KEY] snapshot save
[BACKUP FILE NAME]
In exam, cluster setup is done with kubeadm , this means ETCD
used by the kubernetes cluster is coming from static pod.
kubectl get pod -n kube-system
kubectl describe pod etcd-master -n kube-system
You can locate the information on
endpoint: - advertise-client-urls=https://172.17.0.15:2379
ca certificate: - trusted-cafile=/etc/kubernetes/pki/etcd/ca.crt
server certificate : - certfile=/etc/kubernetes/pki/etcd/server.crt
key: - key-file=/etc/kubernetes/pki/etcd/server.key
To Create backup
export ETCDCTL_API=3
(or)
ETCDCTL_API=3 etcdctl ETCDCTL_API=3 etcdctl --
endpoints=https://172.17.0.15:2379 --
cacert=/etc/kubernetes/pki/etcd/ca.crt --
cert=/etc/kubernetes/pki/etcd/server.crt --
key=/etc/kubernetes/pki/etcd/server.key snapshot save etcdsnapshot.db
//Verify
ETCDCTL_API=3 etcdctl --write-out=table snapshot status
snapshot.db
Answer: B
NEW QUESTION # 31
Create a namespace called 'development' and a pod with image nginx called nginx on this namespace.
Answer:
Explanation:
kubectl create namespace development
kubectl run nginx --image=nginx --restart=Never -n development
NEW QUESTION # 32
Create a Pod with three busy box containers with commands "ls; sleep 3600;", "echo Hello World; sleep 3600;" and "echo this is the third container; sleep 3600" respectively and check the status
- A. // first create single container pod with dry run flag
kubectl run busybox --image=busybox --restart=Always --dry-run
-o yaml -- bin/sh -c "sleep 3600; ls" > multi-container.yaml
// edit the pod to following yaml and create it
apiVersion: v1
kind: Pod
metadata:
labels:
run: busybox
name: busybox
spec:
containers:
- args:
- bin/sh
- -c
- ls; sleep 3600
- echo Hello world; sleep 3600
image: busybox
name: busybox-container-2
- args:
- bin/sh
- -c
- echo this is third container; sleep 3600
image: busybox
name: busybox-container-3
restartPolicy: Always
// Verify
Kubectl get pods - B. // first create single container pod with dry run flag
kubectl run busybox --image=busybox --restart=Always --dry-run
-o yaml -- bin/sh -c "sleep 3600; ls" > multi-container.yaml
// edit the pod to following yaml and create it
apiVersion: v1
kind: Pod
metadata:
labels:
run: busybox
name: busybox
spec:
containers:
- args:
- bin/sh
- -c
- ls; sleep 3600
image: busybox
name: busybox-container-1
- args:
- bin/sh
- -c
- echo Hello world; sleep 3600
image: busybox
name: busybox-container-2
- args:
- bin/sh
- -c
- echo this is third container; sleep 3600
image: busybox
name: busybox-container-3
restartPolicy: Always
// Verify
Kubectl get pods
Answer: B
NEW QUESTION # 33
Check logs of each container that "busyboxpod-{1,2,3}"
- A. kubectl logs busybox -c busybox-container-1
kubectl logs busybox -c busybox-container-2
kubectl logs busybox -c busybox-container-3 - B. kubectl logs busybox -c busybox-container-1
kubectl logs busybox -c busybox-container-3
kubectl logs busybox -c busybox-container-3
Answer: A
NEW QUESTION # 34
......
[Apr-2024] Pass Linux Foundation CKA Exam in First Attempt Guaranteed: https://drive.google.com/open?id=1anU4MDvRWVrQ7Ex1D-QIshoTU-lJT3Id
Reduce Your Chance of Failure in CKA Exam: https://www.freecram.com/Linux-Foundation-certification/CKA-exam-dumps.html