This page was exported from Top Exam Collection [ http://blog.topexamcollection.com ] Export date:Mon Jan 20 11:27:36 2025 / +0000 GMT ___________________________________________________ Title: Enhance Your Career With Available Preparation Guide for CKA Exam [Q18-Q37] --------------------------------------------------- Enhance Your Career With Available Preparation Guide for CKA Exam Get Special Discount Offer of CKA Certification Exam Sample Questions and Answers NEW QUESTION 18Create the nginx pod with version 1.17.4 and expose it on port 80 kubectl run nginx –image=nginx:1.17.4 –restart=Never — port=80NEW QUESTION 19List all the events sorted by timestamp and put them into file.log and verify  kubectl get events –sort-by=.metadata.creationTimestampkubectl get events –sort-by=.metadata.creationTimestamp >test-file.logcat test-file.log  kubectl get events –sort-by=.metadata.creationTimestamp// putting them into file.logkubectl get events –sort-by=.metadata.creationTimestamp >cat test-file.log  kubectl get events –sort-by=.metadata.creationTimestamp// putting them into file.logkubectl get events –sort-by=.metadata.creationTimestamp >test-file.logcat test-file.log NEW QUESTION 20Score: 4%TaskSchedule a pod as follows:* Name: nginx-kusc00401* Image: nginx* Node selector: disk=ssd Solution:#yamlapiVersion: v1kind: Podmetadata:name: nginx-kusc00401spec:containers:– name: nginximage: nginximagePullPolicy: IfNotPresentnodeSelector:disk: spinning#kubectl create -f node-select.yamlNEW QUESTION 21Score:7%ContextAn 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.TaskAdd 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.logUse a Volume, mounted at /var/log, to make the log file big-corp-app.log available to the sidecar container. Solution:#kubectl get pod big-corp-app -o yaml#apiVersion: v1kind: Podmetadata:name: big-corp-appspec:containers:– name: big-corp-appimage: busyboxargs:– /bin/sh– -c– >i=0;while true;doecho “$(date) INFO $i” >> /var/log/big-corp-app.log;i=$((i+1));sleep 1;donevolumeMounts:– name: logsmountPath: /var/log– name: count-log-1image: busyboxargs: [/bin/sh, -c, ‘tail -n+1 -f /var/log/big-corp-app.log’]volumeMounts:– name: logsmountPath: /var/logvolumes:– name: logsemptyDir: {}#kubectl logs big-corp-app -c count-log-1NEW QUESTION 22Check the image version in pod without the describe command See the solution below.Explanationkubectl get po nginx -ojsonpath='{.spec.containers[].image}{“n”}’NEW QUESTION 23Create and configure the service front-end-service so it’s accessible through NodePort and routes to the existing pod named front-end. See the solution below.ExplanationsolutionF:WorkData Entry WorkData Entry20200827CKA8 B.JPGNEW QUESTION 24Change the label for one of the pod to env=uat and list all the pods to verify kubectl label pod/nginx-dev3 env=uat –overwrite kubectl get pods –show-labelsNEW QUESTION 25List pod logs named “frontend” and search for the pattern “started” and write it to a file “/opt/error-logs” Kubectl logs frontend | grep -i “started” > /opt/error-logsNEW QUESTION 26Label a node as app=test and verify kubectl label node node-name app=test // Verify kubectl get no -show-labels kubectl get no -l app=testNEW QUESTION 27Undo the deployment with the previous version and verifyeverything is Ok kubectl rollout undo deploy webapp kubectl rollout status deploy webapp kubectl get podsNEW QUESTION 28Scale the deployment webserver to 6 pods. solutionNEW QUESTION 29Create a configmap called myconfigmap with literal valueappname=myapp  kubectl create cm myconfigmap –from-literal=appname=myapp// Verifykubectl get cm -o yaml(or)kubectl describe cm  kubectl create cm myconfigmap –from-literal=appname=myapp// Verify(or)kubectl describe cm NEW QUESTION 30Create a pod that echo “hello world” and then exists. Have the pod deleted automatically when it’s completed 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 31Get the list of pods of webapp deployment  // Get the label of the deploymentkubectl get deploy –show-labelskubectl get pods -l app=webapp  // Get the label of the deploymentkubectl get deploy –show-labels// Get the pods with that labelkubectl get pods -l app=webapp NEW QUESTION 32Schedule a pod as follows:Name: nginx-kusc00101Image: nginxNode selector: disk=ssd See the solution below.ExplanationsolutionF:WorkData Entry WorkData Entry20200827CKA6 B.JPGF:WorkData Entry WorkData Entry20200827CKA6 C.JPGF:WorkData Entry WorkData Entry20200827CKA6 D.JPGNEW QUESTION 33Add a taint to node “worker-2” with effect as “NoSchedule” andlist the node with taint effect as “NoSchedule”  // Add taint to node “worker-2”kubectl taint nodes worker-2 key=value:NoSchedule.items[*]}{.metadata.name} {.spec.taints[?(@.effect==’NoSchedule’ )].effect}{“n”}{end}” | awk ‘NF==2{print $0}’  // Add taint to node “worker-2”kubectl taint nodes worker-2 key=value:NoSchedule// Verify// Using “custom-coloumns” , you can customize which coloumn tobe printedkubectl get nodes -o customcolumns=NAME:.metadata.name,TAINTS:.spec.taints –no-headers// Using jsonpathkubectl get nodes -o jsonpath=”{range.items[*]}{.metadata.name} {.spec.taints[?(@.effect==’NoSchedule’ )].effect}{“n”}{end}” | awk ‘NF==2{print $0}’ NEW QUESTION 34Create a deployment as follows:Name: nginx-randomExposed via a service nginx-randomEnsure 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. Solution:NEW QUESTION 35Create a pod with environment variables as var1=value1.Check the environment variable in pod  kubectl run nginx –image=nginx –restart=Never –env=var1=value1# thenkubectl exec -it nginx — env# orkubectl describe po nginx | grep value1  kubectl run nginx –image=nginx –restart=Never –env=var1=value1# thenkubectl exec -it nginx — env# orkubectl exec -it nginx — sh -c ‘echo $var1’# orkubectl describe po nginx | grep value1 NEW QUESTION 36Get all the pods with label “env” kubectl get pods -L envNEW QUESTION 37Create an nginx pod and load environment values from the above configmap “keyvalcfgmap” and exec into the pod and verify the environment variables and delete the pod  // first run this command to save the pod yamlkubectl run nginx –image=nginx –restart=Always –dry-run -oyaml > nginx-pod.yml// edit the yml to below file and createvim nginx-pod.ymlapiVersion: v1kind: Podmetadata:labels:run: nginxname: nginxspec:containers:– image: nginxname: nginxenvFrom:– configMapRef:name: keyvalcfgmaprestartPolicy: Alwayskubectl apply -f nginx-pod.yml// verifykubectl exec -it nginx — envkubectl delete po nginx  // first run this command to save the pod yamlkubectl run nginx –image=nginx –restart=Always –dry-run -oyaml > nginx-pod.yml// edit the yml to below file and createvim nginx-pod.ymlapiVersion: v1name: nginxenvFrom:– configMapRef:name: keyvalcfgmaprestartPolicy: Alwayskubectl apply -f nginx-pod.yml// verifykubectl exec -it nginx — envkubectl delete po nginx  Loading … The Linux Foundation Certified Kubernetes Administrator (CKA) Program Certification Exam is designed to test the skills and knowledge of individuals in the field of Kubernetes administration. The exam is aimed at individuals who are responsible for designing, deploying, and maintaining Kubernetes clusters in production environments. The CKA Program Certification Exam is a performance-based exam, which means that candidates will be required to perform tasks on a live Kubernetes cluster rather than answering multiple-choice questions.   Updated CKA Dumps Questions Are Available For Passing Linux Foundation Exam: https://www.topexamcollection.com/CKA-vce-collection.html --------------------------------------------------- Images: https://blog.topexamcollection.com/wp-content/plugins/watu/loading.gif https://blog.topexamcollection.com/wp-content/plugins/watu/loading.gif --------------------------------------------------- --------------------------------------------------- Post date: 2023-04-17 09:36:56 Post date GMT: 2023-04-17 09:36:56 Post modified date: 2023-04-17 09:36:56 Post modified date GMT: 2023-04-17 09:36:56