Cka 4
Cka 4
CKA Dumps
https://www.certleader.com/CKA-dumps.html
NEW QUESTION 1
CORRECT TEXT
List all the pods sorted by name
A. Mastered
B. Not Mastered
Answer: A
Explanation:
kubect1 get pods --sort-by=.metadata.name
NEW QUESTION 2
CORRECT TEXT
List pod logs named “frontend” and search for the pattern “started” and write it to a file “/opt/error-logs”
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Kubectl logs frontend | grep -i “started” > /opt/error-logs
NEW QUESTION 3
CORRECT TEXT
Create and configure the service front-end-service so it's accessible through NodePort and routes to the existing pod named front-end.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 4
CORRECT TEXT
Get IP address of the pod – “nginx-dev”
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Kubect1 get po -o wide
Using JsonPath
kubect1 get pods -o=jsonpath='{range
items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
NEW QUESTION 5
CORRECT TEXT
Score: 7%
Task
Given an existing Kubernetes cluster running version 1.20.0, upgrade all of the Kubernetes control plane and node components on the master node only to version
1.20.1.
Be sure to drain the master node before upgrading it and uncordon it after the upgrade.
You are also expected to upgrade kubelet and kubectl on the master node.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
SOLUTION:
[student@node-1] > ssh ek8s
kubectl cordon k8s-master
kubectl drain k8s-master --delete-local-data --ignore-daemonsets --force
apt-get install kubeadm=1.20.1-00 kubelet=1.20.1-00 kubectl=1.20.1-00 --
disableexcludes=kubernetes
kubeadm upgrade apply 1.20.1 --etcd-upgrade=false
systemctl daemon-reload
systemctl restart kubelet kubectl
uncordon k8s-master
NEW QUESTION 6
CORRECT TEXT
Score: 5%
Task
From the pod label name=cpu-utilizer, find pods running high CPU workloads and write the name of the pod consuming most CPU to the file
/opt/KUTR00401/KUTR00401.txt (which already exists).
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Solution:
kubectl top -l name=cpu-user -A
echo 'pod name' >> /opt/KUT00401/KUT00401.txt
NEW QUESTION 7
CORRECT TEXT
Create a deployment as follows:
? Name: nginx-random
? Exposed via a service nginx-random
? Ensure 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.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Solution:
NEW QUESTION 8
CORRECT TEXT
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.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 9
CORRECT TEXT
Score: 7%
Task
First, create a snapshot of the existing etcd instance running at https://127.0.0.1:2379, saving the snapshot to /srv/data/etcd-snapshot.db.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Solution:
#backup
ETCDCTL_API=3 etcdctl --endpoints="https://127.0.0.1:2379" --
cacert=/opt/KUIN000601/ca.crt --cert=/opt/KUIN000601/etcd-client.crt -- key=/opt/KUIN000601/etcd-client.key snapshot save /etc/data/etcd-snapshot.db
#restore
ETCDCTL_API=3 etcdctl --endpoints="https://127.0.0.1:2379" --
cacert=/opt/KUIN000601/ca.crt --cert=/opt/KUIN000601/etcd-client.crt -- key=/opt/KUIN000601/etcd-client.key snapshot restore /var/lib/backup/etcd-snapshot-
previoys.db
NEW QUESTION 10
CORRECT TEXT
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
A. Mastered
B. Not Mastered
Answer: A
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 10
CORRECT TEXT
Create a snapshot of the etcd instance running at https://127.0.0.1:2379, saving the snapshot to the file path /srv/data/etcd-snapshot.db.
The following TLS certificates/key are supplied for connecting to the server with etcdctl:
? CA certificate: /opt/KUCM00302/ca.crt
? Client certificate: /opt/KUCM00302/etcd-client.crt
? Client key: Topt/KUCM00302/etcd-client.key
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 15
CORRECT TEXT
Score: 7%
Task
Reconfigure the existing deployment front-end and add a port specification named http exposing port 80/tcp of the existing container nginx.
Create a new service named front-end-svc exposing the container port http.
Configure the new service to also expose the individual Pods via a NodePort on the nodes on which they are scheduled.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Solution:
kubectl get deploy front-end
kubectl edit deploy front-end -o yaml
#port specification named http
#service.yaml
apiVersion: v1
kind: Service
metadata:
name: front-end-svc
labels:
app: nginx
spec:
ports:
- port: 80
protocol: tcp
name: http
selector:
app: nginx
type: NodePort
# kubectl create -f service.yaml
# kubectl get svc
# port specification named http
kubectl expose deployment front-end --name=front-end-svc --port=80 --tarport=80 -- type=NodePort
NEW QUESTION 18
CORRECT TEXT
For this item, you will have to ssh to the nodes ik8s-master-0 and ik8s-node-0 and complete all tasks on these nodes. Ensure that you return to the base node
(hostname: node-1) when you have completed this item.
Context
As an administrator of a small development team, you have been asked to set up a Kubernetes cluster to test the viability of a new application.
Task
You must use kubeadm to perform this task. Any kubeadm invocations will require the use of the --ignore-preflight-errors=all option.
? Configure the node ik8s-master-O as a master node. .
? Join the node ik8s-node-o to the cluster.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
You must use the kubeadm configuration file located at /etc/kubeadm.conf when initializingyour cluster.
You may use any CNI plugin to complete this task, but if you don't have your favourite CNI plugin's manifest URL at hand, Calico is one popular option:
https://docs.projectcalico.org/v3.14/manifests/calico.yaml
Docker is already installed on both nodes and apt has been configured so that you can install the required tools.
NEW QUESTION 20
CORRECT TEXT
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.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 22
CORRECT TEXT
Create an nginx pod and list the pod with different levels of verbosity
A. Mastered
B. Not Mastered
Answer: A
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
NEW QUESTION 25
CORRECT TEXT
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.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 26
CORRECT TEXT
From the pod label name=cpu-utilizer, find pods running high CPU workloads and
write the name of the pod consuming most CPU to the file /opt/KUTR00102/KUTR00102.txt
(which already exists).
A.
Answer: Seethesolutionbelow.
Explanation:
solution
NEW QUESTION 29
CORRECT TEXT
Create a pod as follows:
? Name: mongo
? Using Image: mongo
? In a new Kubernetes namespace named: my-website
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 31
CORRECT TEXT
Create a deployment as follows:
? Name: nginx-app
? Using container nginx with version 1.11.10-alpine
? The deployment should contain 3 replicas
Next, deploy the application with new version 1.11.13-alpine, by performing a rolling update.
Finally, rollback that update to the previous version 1.11.10-alpine.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 33
CORRECT TEXT
Create a pod that echo “hello world” and then exists. Have the pod deleted automatically when it’s completed
A. Mastered
B. Not Mastered
Answer: A
Explanation:
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 36
CORRECT TEXT
Get list of all the pods showing name and namespace with a jsonpath expression.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
kubectl get pods -o=jsonpath="{.items[*]['metadata.name'
, 'metadata.namespace']}"
NEW QUESTION 41
CORRECT TEXT
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.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 46
CORRECT TEXT
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 .
A. Mastered
B. Not Mastered
Answer: A
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 50
CORRECT TEXT
Task Weight: 4%
Task
Scale the deployment webserver to 3 pods.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Solution:
NEW QUESTION 51
CORRECT TEXT
List the nginx pod with custom columns POD_NAME and POD_STATUS
A. Mastered
B. Not Mastered
Answer: A
Explanation:
kubectl get po -o=custom-columns="POD_NAME:.metadata.name, POD_STATUS:.status.containerStatuses[].state"
NEW QUESTION 54
CORRECT TEXT
Perform the following tasks:
? Add an init container to hungry-bear (which has been defined in spec file
/opt/KUCC00108/pod-spec-KUCC00108.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
A.
Answer: Seethesolutionbelow.
Explanation:
solution
NEW QUESTION 57
CORRECT TEXT
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.
You can ssh to the failed node using:
[student@node-1] $ | ssh Wk8s-node-0
You can assume elevated privileges on the node with the following command:
[student@w8ks-node-0] $ | sudo –i
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 61
CORRECT TEXT
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.
A. Mastered
B. Not Mastered
Answer: A
Explanation:
solution
NEW QUESTION 63
CORRECT TEXT
Create a busybox pod and add “sleep 3600” command
A. Mastered
B. Not Mastered
Answer: A
Explanation:
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c
"sleep 3600"
NEW QUESTION 66
CORRECT TEXT
Score: 5%
Task
Monitor the logs of pod bar and:
• Extract log lines corresponding to error file-not-found
• Write them to /opt/KUTR00101/bar
A. Mastered
B. Not Mastered
Answer: A
Explanation:
Solution:
kubectl logs bar | grep 'unable-to-access-website' > /opt/KUTR00101/bar
cat /opt/KUTR00101/bar
NEW QUESTION 71
CORRECT TEXT
List all the pods sorted by created timestamp
A. Mastered
B. Not Mastered
Answer: A
Explanation:
kubect1 get pods--sort-by=.metadata.creationTimestamp
NEW QUESTION 73
CORRECT TEXT
Score: 4%
Task
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.
A. Mastered
B. Not Mastered
Answer: A
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 77
......
100% Pass Your CKA Exam with Our Prep Materials Via below:
https://www.certleader.com/CKA-dumps.html