Master 2021 Latest The Questions Kubernetes Administrator and Pass CKA Real Exam! [Q12-Q30]

Share

Master 2021 Latest The Questions Kubernetes Administrator and Pass CKA  Real Exam!

Penetration testers simulate CKA exam PDF

NEW QUESTION 12
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 13
Print pod name and start time to "/opt/pod-status" file

Answer:

Explanation:
See the solution below.
Explanation
kubect1 get pods -o=jsonpath='{range
items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'

 

NEW QUESTION 14
List "nginx-dev" and "nginx-prod" pod and delete those pods

Answer:

Explanation:
See the solution below.
Explanation
kubect1 get pods -o wide
kubectl delete po "nginx-dev"kubectl delete po "nginx-prod"

 

NEW QUESTION 15
Score: 4%

Task
Check to see how many nodes are ready (not including nodes tainted NoSchedule ) and write the number to
/opt/KUSC00402/kusc00402.txt

Answer:

Explanation:
See the solution below.
Explanation
Solution:
kubectl describe nodes | grep ready|wc -l
kubectl describe nodes | grep -i taint | grep -i noschedule |wc -l
echo 3 > /opt/KUSC00402/kusc00402.txt
#
kubectl get node | grep -i ready |wc -l
# taintsnoSchedule
kubectl describe nodes | grep -i taints | grep -i noschedule |wc -l
#
echo 2 > /opt/KUSC00402/kusc00402.txt

 

NEW QUESTION 16
Create a redis pod, and have it use a non-persistent storage
Note: In exam, you will have access to kubernetes.io site,
Refer : https://kubernetes.io/docs/tasks/configure-pod-container/configurevolume-storage/

  • A. apiVersion: v1
    kind: Pod
    metadata:
    name: redis
    spec:
    containers:
    - name: redis
    image: redis
    volumeMounts:
    - name: redis-storage
    mountPath: /data/redis
    ports:
    - containerPort: 6379
    volumes:
    - name: redis-storage
    emptyDir: {}
  • B. apiVersion: v1
    kind: Pod
    metadata:
    name: redis
    spec:
    containers:
    - name: redis
    image: redis
    volumeMounts:
    - containerPort: 6379
    volumes:
    - name: redis-storage
    emptyDir: {}

Answer: A

 

NEW QUESTION 17
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 18
Which one is the correct configuration?

  • A. &Panorama
  • B. @Panorama
  • C. $Panorama
  • D. #Panorama

Answer: C

 

NEW QUESTION 19
Fix a node that shows as non-ready

  • A. Kubectl get nodes
    // Check which node shows a not ready
    kubectl describe nodes "node-name"
    // Login to the node which shows as not ready and check the
    systemctl start kubelet / docker
    // Verify
    ps -auxxww | grep -i "process-name"
    kubectl get nodes
  • B. Kubectl get nodes
    // Check which node shows a not ready
    kubectl describe nodes "node-name"
    // Login to the node which shows as not ready and check the
    process for kubelet, docker , kube-proxy.
    // systemctl status kubelet (or) ps -aux | grep -i "processname"
    // If the process is not started, then start using
    systemctl start kubelet / docker
    // Verify
    ps -auxxww | grep -i "process-name"
    kubectl get nodes

Answer: B

 

NEW QUESTION 20
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 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
List the nginx pod with custom columns POD_NAME and POD_STATUS

Answer:

Explanation:
See the solution below.
Explanation
kubectl get po -o=custom-columns="POD_NAME:.metadata.name,
POD_STATUS:.status.containerStatuses[].state"

 

NEW QUESTION 23
Scale down the deployment to 1 replica

Answer:

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

 

NEW QUESTION 24
Annotate the pod with name=webapp

  • A. kubectl annotate pod nginx-dev-pod name=webapp
    kubectl annotate pod nginx-prod-pod name=webapp
    // Verify
    kubectl describe po nginx-dev-pod | grep -i annotations
  • B. kubectl annotate pod nginx-dev-pod name=webapp
    kubectl annotate pod nginx-prod-pod name=webapp
    // Verify
    kubectl describe po nginx-dev-pod | grep -i annotations
    kubectl describe po nginx-prod-pod | grep -i annotations

Answer: B

 

NEW QUESTION 25
Score: 4%

Task
Create a persistent volume with name app-data , of capacity 1Gi and access mode ReadOnlyMany. The type of volume is hostPath and its location is /srv/app-data .

Answer:

Explanation:
See the solution below.
Explanation
Solution:
#vi pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-config
spec:
capacity:
storage: 1Gi
accessModes:
- ReadOnlyMany
hostPath:
path: /srv/app-config
#
kubectl create -f pv.yaml

 

NEW QUESTION 26
Score: 4%

Context
You have been asked to create a new ClusterRole for a deployment pipeline and bind it to a specific ServiceAccount scoped to a specific namespace.
Task
Create a new ClusterRole named deployment-clusterrole, which only allows to create the following resource types:
* Deployment
* StatefulSet
* DaemonSet
Create a new ServiceAccount named cicd-token in the existing namespace app-team1.
Bind the new ClusterRole deployment-clusterrole lo the new ServiceAccount cicd-token , limited to the namespace app-team1.

Answer:

Explanation:
See the solution below.
Explanation
Solution:
Task should be complete on node -1 master, 2 worker for this connect use command
[student@node-1] > ssh k8s
kubectl create clusterrole deployment-clusterrole --verb=create
--resource=deployments,statefulsets,daemonsets
kubectl create serviceaccount cicd-token --namespace=app-team1
kubectl create rolebinding deployment-clusterrole --clusterrole=deployment-clusterrole
--serviceaccount=default:cicd-token --namespace=app-team1

 

NEW QUESTION 27
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 28
Perform the following tasks:
* Add an init container tohungry-bear(which has beendefined in spec file
/opt/KUCC00108/pod-spec-KUCC00108.yaml)
* The init container should createan empty file named/workdir/calm.txt
* If/workdir/calm.txtis notdetected, the pod should exit
* Once the spec file has beenupdatedwith the init containerdefinition, the pod should becreated

Answer:

Explanation:
See the solution below.
Explanation
solution


 

NEW QUESTION 29
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




 

NEW QUESTION 30
......

Penetration testers simulate CKA exam: https://www.actual4dumps.com/CKA-study-material.html

Bestselling On-The-Job Reference Exam Questionshttps://drive.google.com/open?id=1fb2QUs63toQPP7mAUIijzqbkmSpvq4Cj