Kubernetes Administrator Real Exam Questions and Answers FREE CKA Updated on Sep 06, 2021 [Q14-Q33]

Share

Kubernetes Administrator CKA Real Exam Questions and Answers FREE Updated on Sep 06, 2021

CKA Ultimate Study Guide -  Prep4King

NEW QUESTION 14
Create a pod as follows:
Name: mongo
Using Image: mongo
In a new Kubernetes namespace named: my-website

Answer:

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

 

NEW QUESTION 15
Clean the cluster by deleting deployment and hpa you just created

Answer:

Explanation:
kubectl delete deploy webapp kubectl delete hpa webapp

 

NEW QUESTION 16
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 17
Updates to dynamic user group membership are automatic therefore using dynamic user groups instead of static group objects allows you to:

  • A. respond to changes in user behavior and confirmed threats with manual policy changes
  • B. respond to changes in user behavior or potential threats without manual policy changes
  • C. respond to changes in user behavior or potential threats without automatic policy changes
  • D. respond to changes in user behavior or potential threats using manual policy changes

Answer: B

 

NEW QUESTION 18
Create a Pod nginx and specify both CPU, memory requests and limits together and verify.

  • A. kubectl run nginx-request --image=nginx --restart=Always --dryrun -o yaml > nginx-request.yml
    // add the resources section and create
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: nginx
    name: nginx-request
    spec:
    containers:
    - image: nginx
    name: nginx
    resources:
    requests:
    memory: "100Mi"
    cpu: "0.5"
    limits:
    memory: "200Mi"
    cpu: "1"
    restartPolicy: Always
    k kubectl apply -f nginx-request.yaml
    // Verify
    Kubectl top po
  • B. kubectl run nginx-request --image=nginx --restart=Always --dryrun -o yaml > nginx-request.yml
    // add the resources section and create
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: nginx
    name: nginx
    resources:
    requests:
    memory: "100Mi"
    cpu: "0.4"
    limits:
    memory: "200Mi"
    cpu: "7"
    restartPolicy: Always
    k kubectl apply -f nginx-request.yaml
    // Verify
    Kubectl top po

Answer: A

 

NEW QUESTION 19
Change the label for one of the pod to env=uat and list all the pods to verify

Answer:

Explanation:
kubectl label pod/nginx-dev3 env=uat --overwrite kubectl get pods --show-labels

 

NEW QUESTION 20
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 21
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 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"}'
  • 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 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: A

 

NEW QUESTION 22
Create PersistentVolume named task-pv-volume with storage 10Gi, access modes ReadWriteMany, storageClassName manual, and volume at /mnt/data and Create a PersistentVolumeClaim of at least 3Gi storage and access mode ReadWriteOnce and verify

  • A. vim task-pv-volume.yaml
    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: task-pv-volume
    labels:
    type: local
    spec:
    storageClassName: manual
    capacity:
    storage: 10Gi
    accessModes:
    - ReadWriteMany
    hostPath:
    path: "/mnt/data"
    kubectl apply -f task-pv-volume.yaml
    //Verify
    kubectl get pv
    vim task-pvc-volume.yaml
    apiVersion: v1
    - ReadWriteMany
    resources:
    requests:
    storage: 3Gi
    kubectl apply -f task-pvc-volume.yaml
    //Verify
    Kuk kubectl get pvc
  • B. vim task-pv-volume.yaml
    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: task-pv-volume
    labels:
    type: local
    spec:
    storageClassName: manual
    capacity:
    storage: 10Gi
    accessModes:
    - ReadWriteMany
    hostPath:
    path: "/mnt/data"
    kubectl apply -f task-pv-volume.yaml
    //Verify
    kubectl get pv
    vim task-pvc-volume.yaml
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: task-pv-claim
    spec:
    storageClassName: manual
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: 3Gi
    kubectl apply -f task-pvc-volume.yaml
    //Verify
    Kuk kubectl get pvc

Answer: B

 

NEW QUESTION 23
Create a Kubernetes secret as follows:
Name: super-secret
password: bob
Create a pod named pod-secrets-via-file, using the redis Image, which mounts a secret named super-secret at
/secrets.
Create a second pod named pod-secrets-via-env, using the redis Image, which exports password as CONFIDENTIAL

Answer:

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

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

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

 

NEW QUESTION 24
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 25
Score: 4%

Task
Create a pod named kucc8 with a single app container for each of the following images running inside (there may be between 1 and 4 images specified): nginx + redis + memcached .

Answer:

Explanation:
See the solution below.
Explanation
Solution:
kubectl run kucc8 --image=nginx --dry-run -o yaml > kucc8.yaml
# vi kucc8.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kucc8
spec:
containers:
- image: nginx
name: nginx
- image: redis
name: redis
- image: memcached
name: memcached
- image: consul
name: consul
#
kubectl create -f kucc8.yaml
#12.07

 

NEW QUESTION 26
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 27
Modify "hello-job" and make it run 10 times one after one and 5 times parallelism: 5

  • A. kubectl create job hello-job --image=busybox --dry-run -o yaml
    -- echo "Hello I am from job" > hello-job.yaml
    // edit the yaml file to add completions: 10 and
    kubectl create -f hello-job.yaml
    YAML File:
    apiVersion: batch/v1
    kind: Job
    metadata:
    name: hello-job
    spec:
    completions: 10
    parallelism: 5
    template:
    metadata:
    spec:
    containers:
    - command:
    - echo
    - Hello I am from job
    image: busybox
    name: hello-job
    restartPolicy: Never
  • B. kubectl create job hello-job --image=busybox --dry-run -o yaml
    -- echo "Hello I am from job" > hello-job.yaml
    // edit the yaml file to add completions: 16 and
    kubectl create -f hello-job.yaml
    YAML File:
    apiVersion: batch/v1
    kind: Job
    metadata:
    name: hello-job
    spec:
    completions: 16
    parallelism: 5
    template:
    metadata:
    spec:
    containers:
    - command:
    - echo
    - Hello I am from job
    image: busybox
    name: hello-job
    restartPolicy: Never

Answer: A

 

NEW QUESTION 28
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 29
Create a job named "hello-job" with the image busybox which echos "Hello I'm running job"

  • A. kubectl create job hello-job --image=busybox --dry-run -o yaml
    -- echo "Hello I'm running job" > hello-job.yaml
    kubectl create -f hello-job.yaml
    //Verify Job
    kubectl get job
    kubectl get po
    kubectl logs hello-job-*
  • B. kubectl create job hello-job --image=busybox --dry-run -o yaml
    -- echo "Hello I'm running job" > hello-job.yaml
    kubectl create -f hello-job.yaml
    //Verify Job
    kubectl get po
    kubectl logs hello-job-*

Answer: A

 

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

  • A. 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
  • B. kubectl run nginx --image=nginx --restart=Never --env=var1=value1
    # then
    kubectl exec -it nginx -- env
    # or
    kubectl describe po nginx | grep value1

Answer: A

 

NEW QUESTION 31
Create a redis pod and expose it on port 6379

  • A. kubectl run redis --image=redis --restart=Never --port=6379
    YAML File :
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: redis
    name: redis
    spec:
    containers:
    - image: redis
    name: redis
    ports:
    - containerPort: 6379
    Rt restartPolicy: Always
  • B. kubectl run redis --image=redis --restart=Never --port=6379
    YAML File :
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    run: redis
    name: redis
    spec:
    containers:
    ports:
    - containerPort: 6679
    Rt restartPolicy: Alwaysf

Answer: A

 

NEW QUESTION 32
Create a pod that having 3 containers in it? (Multi-Container)

Answer:

Explanation:
See the solution below.
Explanation
image=nginx, image=redis, image=consul
Name nginx container as "nginx-container"
Name redis container as "redis-container"
Name consul container as "consul-container"
Create a pod manifest file for a container and append container
section for rest of the images
kubectl run multi-container --generator=run-pod/v1 --image=nginx --
dry-run -o yaml > multi-container.yaml
# then
vim multi-container.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: multi-container
name: multi-container
spec:
containers:
- image: nginx
name: nginx-container
- image: redis
name: redis-container
- image: consul
name: consul-container
restartPolicy: Always

 

NEW QUESTION 33
......

Ultimate Guide to Prepare CKA Certification Exam for Kubernetes Administrator: https://www.prep4king.com/CKA-exam-prep-material.html

Use Real CKA Dumps - Linux Foundation Correct Answers: https://drive.google.com/open?id=1lKuIIcOcMbEOjtuDAY0NBDw3b9RuRUTs