CKA Exam Dumps, CKA Practice Test Questions [Q18-Q40]

Share

CKA Exam Dumps, CKA Practice Test Questions

PDF (New 2022) Actual Linux Foundation CKA Exam Questions

NEW QUESTION 18
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 19
Create a deployment as follows:
Name: nginx-app
Using container nginx with version 1.11.10-alpine
The deployment should contain
Next, deploy the application with new version , by performing a rolling update.
Finally, rollback that update to the previous version

Answer:

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

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

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

 

NEW QUESTION 20
Create a pod as follows:
* Name:mongo
* Using Image:mongo
* In anew Kubernetes namespacenamed:my-website

Answer:

Explanation:
See the solution below.
Explanation
solution

 

NEW QUESTION 21
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 22
List all configmap and secrets in the cluster in all namespace and write it to a file /opt/configmap-secret

Answer:

Explanation:
kubectl get configmap,secrets --all-namespaces > /opt/configmap-secret // Verify Cat /opt/configmap-secret

 

NEW QUESTION 23
Get list of all the nodes with labels

Answer:

Explanation:
kubectl get nodes --show-labels

 

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

Answer:

Explanation:
See the solution below.
Explanation
solution

 

NEW QUESTION 25
Create a busybox pod that runs the command "env" and save the output to "envpod" file

Answer:

Explanation:
kubectl run busybox --image=busybox --restart=Never --rm -it -- env > envpod.yaml

 

NEW QUESTION 26
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 27
Create a Kubernetes secret asfollows:
* Name: super-secret
* password: bob
Create a pod namedpod-secrets-via-file Image, which mounts a secret namedsuper-secretat
/secrets.
Create a second pod namedpod-secrets-via-env Image, which exportspasswordas CONFIDENTIAL

Answer:

Explanation:
See the solution below.
Explanation
solution


 

NEW QUESTION 28
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:
solution


 

NEW QUESTION 29
Deploy a pod with image=redis on a node with label disktype=ssd

  • A. // Get list of nodes
    kubectl get nodes
    //Get node with the label disktype=ssd
    kubectl get no -l disktype=ssd
    // Create a sample yaml file
    kubectl run node-redis --generator=run-pod/v1 --image=redis --dry
    run -o yaml > test-redis.yaml
    // Edit test-redis.yaml file and add nodeSelector
    vim test-redis.yaml
    apiVersion: v1
    - name: node-redis
    image: redis
    imagePullPolicy: IfNotPresent
    kubectl apply -f test-redis.yaml
    / // Verify
    K kubectl get po -o wide
  • B. // Get list of nodes
    kubectl get nodes
    //Get node with the label disktype=ssd
    kubectl get no -l disktype=ssd
    // Create a sample yaml file
    kubectl run node-redis --generator=run-pod/v1 --image=redis --dry
    run -o yaml > test-redis.yaml
    // Edit test-redis.yaml file and add nodeSelector
    vim test-redis.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: redis
    spec:
    nodeSelector:
    disktype: ssd
    containers:
    - name: node-redis
    image: redis
    imagePullPolicy: IfNotPresent
    kubectl apply -f test-redis.yaml
    / // Verify
    K kubectl get po -o wide

Answer: B

 

NEW QUESTION 30
Score: 4%

Task
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.

Answer:

Explanation:
See the solution below.
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 31
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 32
Ensure a single instance of pod nginx is running on each node of the Kubernetes cluster where nginx also represents the Image name which has to be used. Do not override any taints currently in place.
Use DaemonSet to complete this task and use ds-kusc00201 as DaemonSet name.

Answer:

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

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

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

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

 

NEW QUESTION 33
Create an nginx pod with containerPort 80 and with a PersistentVolumeClaim "task-pv-claim" and has a mouth path "/usr/share/nginx/html"

  • A. vim nginx-pvc-pod.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: task-pv-pod
    spec:
    volumes:
    - name: task-pv-storage
    persistentVolumeClaim:
    claimName: task-pv-claim
    containers:
    - name: task-pv-container
    image: nginx
    ports:
    - containerPort: 60
    name: "http"
    volumeMounts:
    - mountPath: "/usr/share/nginx/html"
    name: task-pv-storage
    kubectl apply -f nginx-pvc-pod.yaml
    // Verify
    kubectl describe po "POD-Name" | grep -i volumes -A4
    Volumes:
    task-pv-storage:
    Type: PersistentVolumeClaim (a reference to a
    PersistentVolumeClaim in the same namespace)
    ClaimName: task-pv-claim
    ReadOnly: false
  • B. vim nginx-pvc-pod.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: task-pv-pod
    spec:
    volumes:
    - name: task-pv-storage
    persistentVolumeClaim:
    claimName: task-pv-claim
    containers:
    - name: task-pv-container
    image: nginx
    ports:
    - containerPort: 80
    name: "http"
    volumeMounts:
    - mountPath: "/usr/share/nginx/html"
    name: task-pv-storage
    kubectl apply -f nginx-pvc-pod.yaml
    // Verify
    kubectl describe po "POD-Name" | grep -i volumes -A5
    Volumes:
    task-pv-storage:
    Type: PersistentVolumeClaim (a reference to a
    PersistentVolumeClaim in the same namespace)
    ClaimName: task-pv-claim
    ReadOnly: false

Answer: B

 

NEW QUESTION 34
Change the Image version back to 1.17.1 for the pod you just updated and observe the changes

Answer:

Explanation:
kubectl set image pod/nginx nginx=nginx:1.17.1 kubectl describe po nginx kubectl get po nginx -w # watch it

 

NEW QUESTION 35
Create a busybox pod and add "sleep 3600" command

Answer:

Explanation:
See the solution below.
Explanation
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c
"sleep 3600"

 

NEW QUESTION 36
Check the rollout history and make sure everything is ok after the update

  • A. kubectl rollout history deploy webapp
    kubectl get deploy webapp --show-labels
    kubectl get rs -
    kubectl get po -l app=webapp
  • B. kubectl rollout history deploy webapp
    kubectl get deploy webapp --show-labels
    kubectl get rs -l app=webapp
    kubectl get po -l app=webapp

Answer: B

 

NEW QUESTION 37
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.

Answer:

Explanation:
See the solution below.
Explanation
Solution:
sudo -i
systemctl status kubelet
systemctl start kubelet
systemctl enable kubelet

 

NEW QUESTION 38
Scale the deployment to 5 replicas

Answer:

Explanation:
kubectl scale deployment webapp -replicas=5 //Verify kubectl get deploy kubectl get po,rs

 

NEW QUESTION 39
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 40
......

Updated Jul-2022 Pass CKA Exam - Real Practice Test Questions: https://www.prepawayete.com/Linux-Foundation/CKA-practice-exam-dumps.html

Dumps Moneyack Guarantee - CKA Dumps UpTo 90% Off: https://drive.google.com/open?id=1mt6mPIWLiRsOiKMfMkioCGejbXfXjn31

Contact Us

If you have any question please leave me your email address, we will reply and send email to you in 12 hours.

Our Working Time: ( GMT 0:00-15:00 )
From Monday to Saturday

Support: Contact now