[Q18-Q42] Free Sales Ending Soon - Use Real CKA PDF Questions [May 21, 2023]

Share

Free Sales Ending Soon - Use Real CKA PDF Questions [May 21, 2023]

Updated May-2023 Exam CKA Dumps - Pass Your Certification Exam

NEW QUESTION # 18
Get the pods with labels env=dev and env=prod and output the labels as well

Answer:

Explanation:
kubectl get pods -l 'env in (dev,prod)' --show-labels


NEW QUESTION # 19
Perform the following tasks:
Add an init container to hungry-bear (which has been defined in spec file /opt/KUCC00108/pod-spec-KUC C00108.yaml ) The init container should create an empty file named /workdir/calm.txt If /workdir/calm.txt is not detected, the pod should exit Once the spec file has been updated with the init container definition, the pod should be created

Answer:

Explanation:
solution



NEW QUESTION # 20
Undo the deployment to the previous version 1.17.1 and verify Image has the previous version

Answer:

Explanation:
kubectl rollout undo deploy webapp kubectl describe deploy webapp | grep Image


NEW QUESTION # 21
Create a file:
/opt/KUCC00302/kucc00302.txt that lists all pods that implement service baz in namespace development.
The format of the file should be one pod name per line.

Answer:

Explanation:
See the solution below.
Explanation
solution
F:\Work\Data Entry Work\Data Entry\20200827\CKA\11 B.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\11 C.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\11 D.JPG


NEW QUESTION # 22
Create a file called "config.txt" with two values key1=value1
and key2=value2. Then create a configmap named "keyvalcfgmap" andread data from the file "config.txt" and verify that configmap is created correctly

  • A. cat >> config.txt << EOF
    key1=value1
    key2=value2
    EOF
    cat config.txt
    // Create configmap from "config.txt" file
    kubectl create cm keyvalcfgmap --from-file=config.txt
    //Verify
    kubectl get cm keyvalcfgmap -o yaml
  • B. cat >> config.txt << EOF
    key1=value1
    key2=value2
    EOF
    kubectl create cm keyvalcfgmap --from-file=config.txt
    //Verify
    kubectl get cm keyvalcfgmap -o yaml

Answer: A


NEW QUESTION # 23
Get the DNS records for the service and pods for the deployment redis and the put the value in /tmp/dnsrecordpod and /tmp/dnsrecord-service

  • A. // Get Pod Ip
    kubectl get po -o wide
    // Get Service Name
    kubectl get svc
    // Create a temporary pod and execute nslookup command
    Note: POD IP format should be a-b-c-d and not a.b.c.d
    kubectl run busybox --image=busybox:1.28 --restart=Never -
    -rm -it -- nslookup 192-168-0-69.default.pod >
    /tmp/dnsrecord-pod
    kubectl run busybox1 --image=busybox:1.26 --restart=Never
    --rm -it -- nslookup redis-service > /tmp/dnsrecordservice
    //Verify
    cat /tmp/dnsrecord-pod
    Server: 10.2.8.10
    Address 1: 10.2.0.10 kube-dns.kube system.svc.cluster.local Name: 192-168-0-69.default.pod Address 1: 192.168.0.69 192-166-0-69.redis service.default.svc.cluster.local cat /tmp/dnsrecord-pod Server: 10.2.0.10 Address 1: 10.2.0.10 kube-dns.kube system.svc.cluster.local Name: 192-168-0-69.default.pod Address 1: 192.168.0.69 192-168-0-69.redis service.default.svc.cluster.local
  • B. // Get Pod Ip
    kubectl get po -o wide
    // Get Service Name
    kubectl get svc
    // Create a temporary pod and execute nslookup command
    Note: POD IP format should be a-b-c-d and not a.b.c.d
    kubectl run busybox --image=busybox:1.28 --restart=Never -
    -rm -it -- nslookup 192-168-0-69.default.pod >
    /tmp/dnsrecord-pod
    kubectl run busybox1 --image=busybox:1.28 --restart=Never
    --rm -it -- nslookup redis-service > /tmp/dnsrecordservice
    //Verify
    cat /tmp/dnsrecord-pod
    Server: 10.2.0.10
    Address 1: 10.2.0.10 kube-dns.kube system.svc.cluster.local Name: 192-168-0-69.default.pod Address 1: 192.168.0.69 192-168-0-69.redis service.default.svc.cluster.local cat /tmp/dnsrecord-pod Server: 10.2.0.10 Address 1: 10.2.0.10 kube-dns.kube system.svc.cluster.local Name: 192-168-0-69.default.pod Address 1: 192.168.0.69 192-168-0-69.redis service.default.svc.cluster.local

Answer: B


NEW QUESTION # 24
Create a nginx pod that will be deployed to node with the label
"gpu=true"

  • A. kubectl run nginx --image=nginx --restart=Always --dry-run -o
    yaml > nodeselector-pod.yaml
    // add the nodeSelector like below and create the pod
    kubectl apply -f nodeselector-pod.yaml
    vim nodeselector-pod.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: nginx
    spec:
    nodeSelector:
    gpu: true
    containers:
    - image: nginx
    name: nginx
    restartPolicy: Always
    kubectl apply -f nodeselector-pod.yaml
    //Verify
    kubectl get no -show-labels
    kubectl get po
    kubectl describe po nginx | grep Node-Selectors
  • B. kubectl run nginx --image=nginx --restart=Always --dry-run -o
    yaml > nodeselector-pod.yaml
    // add the nodeSelector like below and create the pod
    kubectl apply -f nodeselector-pod.yaml
    vim nodeselector-pod.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: nginx
    spec:
    nodeSelector:
    gpu: true
    yaml
    //Verify
    kubectl get no -show-labels
    kubectl get po
    kubectl describe po nginx | grep Node-Selectors

Answer: A


NEW QUESTION # 25
Monitor the logs of pod foo and:
* Extract log lines corresponding unable-to-access-website
* Write them to/opt/KULM00201/foo

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 26
Get list of PVs and order by size and write to file - /opt/pvlist.txt

Answer:

Explanation:
kubectl get pv --sort-by=.spec.capacity.storage > /opt/pvlist.txt


NEW QUESTION # 27
Check the Image version of nginx-dev pod using jsonpath

Answer:

Explanation:
kubect1 get po nginx-dev -o
jsonpath='{.spec.containers[].image}{"\n"}'


NEW QUESTION # 28
Pause the rollout of the deployment

Answer:

Explanation:
kubectl rollout pause deploy webapp


NEW QUESTION # 29
Create a deployment spec file that will:
* Launch 7 replicas of the nginx Image with the labelapp_runtime_stage=dev
* deployment name: kual00201
Save a copy of this spec file to /opt/KUAL00201/spec_deployment.yaml
(or /opt/KUAL00201/spec_deployment.json).
When you are done, clean up (delete) any new Kubernetes API object that you produced during this task.

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 30
Score: 7%

Task
Create a new nginx Ingress resource as follows:
* Name: ping
* Namespace: ing-internal
* Exposing service hi on path /hi using service port 5678

Answer:

Explanation:
Solution:
vi ingress.yaml
#
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ping
namespace: ing-internal
spec:
rules:
- http:
paths:
- path: /hi
pathType: Prefix
backend:
service:
name: hi
port:
number: 5678
#
kubectl create -f ingress.yaml


NEW QUESTION # 31
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.

Answer:

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


NEW QUESTION # 32
Create an nginx pod and list the pod with different levels of verbosity

Answer:

Explanation:
See the solution below.
Explanation
// 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


NEW QUESTION # 33
Score: 7%

Task
Create a new NetworkPolicy named allow-port-from-namespace in the existing namespace echo. Ensure that the new NetworkPolicy allows Pods in namespace my-app to connect to port 9000 of Pods in namespace echo.
Further ensure that the new NetworkPolicy:
* does not allow access to Pods, which don't listen on port 9000
* does not allow access from Pods, which are not in namespace my-app

Answer:

Explanation:
Solution:
#network.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-from-namespace
namespace: internal
spec:
podSelector:
matchLabels: {
}
policyTypes:
- Ingress
ingress:
- from:
- podSelector: {
}
ports:
- protocol: TCP
port: 8080
#spec.podSelector namespace pod
kubectl create -f network.yaml


NEW QUESTION # 34
Configure the kubelet systemd- managed service, on the node labelled with name=wk8s-node-1, to launch a pod containing a single container of Image httpd named webtool automatically. Any spec files required should be placed in the /etc/kubernetes/manifests directory on the node.
You can ssh to the appropriate node using:
[student@node-1] $ ssh wk8s-node-1
You can assume elevated privileges on the node with the following command:
[student@wk8s-node-1] $ | sudo -i

Answer:

Explanation:
See the solution below.
Explanation
solution
F:\Work\Data Entry Work\Data Entry\20200827\CKA\21 C.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\21 D.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\21 E.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\21 F.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\21 G.JPG


NEW QUESTION # 35
Create a pod with image nginx called nginx and allow traffic on port 80

Answer:

Explanation:
See the solution below.
Explanation
kubectlrun nginx --image=nginx --restart=Never --port=80


NEW QUESTION # 36
Check to see how many worker nodes are ready (not including nodes tainted NoSchedule) and write the number to /opt/KUCC00104/kucc00104.txt.

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 37
Check the image version in pod without the describe command

Answer:

Explanation:
kubectl get po nginx -o
jsonpath='{.spec.containers[].image}{"\n"}'


NEW QUESTION # 38
Create a pod with environment variables as var1=value1.Check the environment variable in pod

Answer:

Explanation:
kubectl run nginx --image=nginx --restart=Never --env=var1=value1
# then
kubectl exec -it nginx -- env
# or
kubectl exec -it nginx -- sh -c 'echo $var1'
# or
kubectl describe po nginx | grep value1


NEW QUESTION # 39
Update the deployment with the image version 1.17.4 and verify

  • A. kubectl set image deploy/webapp nginx=nginx:1.17.4
    //Verify
    kubectl describe deploy webapp | grep Image
    kubectl get deploy -
    {.metadata.name}{"\t"}{.spec.template.spec.containers[*].i
    mage}{"\n"}'
  • B. kubectl set image deploy/webapp nginx=nginx:1.17.4
    //Verify
    kubectl describe deploy webapp | grep Image
    kubectl get deploy -o=jsonpath='{range.items [*]}{.[*]}
    {.metadata.name}{"\t"}{.spec.template.spec.containers[*].i
    mage}{"\n"}'

Answer: B


NEW QUESTION # 40
List all persistent volumes sorted by capacity, saving the full kubectl output to /opt/KUCC00102/volume_list. Use kubectl 's own functionality for sorting the output, and do not manipulate it any further.

Answer:

Explanation:
solution


NEW QUESTION # 41
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 # 42
......

CKA Dumps To Pass Kubernetes Administrator Exam in One Day: https://www.prepawaypdf.com/Linux-Foundation/CKA-practice-exam-dumps.html

Latest Real Linux Foundation CKA Exam Dumps Questions: https://drive.google.com/open?id=1h3w_X4EzloZ2OFF9mBOU7UN0xLHt52bJ