Ckav7 0
Ckav7 0
Exam CKA
Certified Kubernetes Administrator (CKA)
Program
Version: 7.0
[ Total Questions: 67 ]
Certify For Sure with IT Exam Dumps
1. CORRECT TEXT
Score: 4%
Task
Create a persistent volume with name app-data , of capacity 1Gi and access mode ReadOnlyMany. The
Answer:
Explanation:
Solution:
#vi pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-config
spec:
capacity:
storage: 1Gi
accessModes:
- ReadOnlyMany
hostPath:
path: /srv/app-config
1
Certify For Sure with IT Exam Dumps
kubectl create -f pv.yaml
2. CORRECT TEXT
Create a pod with environment variables as var1=value1.Check the environment variable in pod
Answer:
Explanation:
# then
# or
# or
3. CORRECT TEXT
Answer:
Explanation:
4. CORRECT TEXT
Create 2 nginx image pods in which one of them is labelled with env=prod and another one
Answer:
Explanation:
2
Certify For Sure with IT Exam Dumps
-o yaml > nginx-prodpod.yaml Now, edit nginx-prod-pod.yaml file and remove entries like
vim nginx-prod-pod.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
env: prod
name: nginx-prod
spec:
containers:
- image: nginx
name: nginx-prod
restartPolicy: Always
apiVersion: v1
kind: Pod
metadata:
labels:
env: dev
name: nginx-dev
spec:
containers:
- image: nginx
name: nginx-dev
restartPolicy: Always
Verify :
3
Certify For Sure with IT Exam Dumps
kubectl get po --show-labels
5. CORRECT TEXT
Score: 4%
Task
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.
Answer:
Explanation:
SOLUTION:
6. CORRECT TEXT
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
4
Certify For Sure with IT Exam Dumps
7. CORRECT TEXT
Score: 5%
Task
Answer:
Explanation: Solution:
cat /opt/KUTR00101/bar
8. CORRECT TEXT
Answer:
Explanation:
9. CORRECT TEXT
5
Certify For Sure with IT Exam Dumps
Answer:
Explanation:
YAML File:
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: engineering
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Never
✑ Name: nginx-kusc00101
✑ Image: nginx
Answer:
6
Certify For Sure with IT Exam Dumps
Explanation:
solution
7
Certify For Sure with IT Exam Dumps
F:\Work\Data Entry Work\Data Entry\20200827\CKA\6 C.JPG
List the nginx pod with custom columns POD_NAME and POD_STATUS
Answer:
Explanation:
POD_STATUS:.status.containerStatuses[].state"
Answer:
Explanation:
8
Certify For Sure with IT Exam Dumps
image=nginx, image=redis, image=consul
# 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
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
9
Certify For Sure with IT Exam Dumps
You can ssh to the appropriate node using:
You can assume elevated privileges on the node with the following command:
[student@wk8s-node-1] $ | sudo –i
Answer:
Explanation:
solution
10
Certify For Sure with IT Exam Dumps
11
Certify For Sure with IT Exam Dumps
12
Certify For Sure with IT Exam Dumps
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:
solution
13
Certify For Sure with IT Exam Dumps
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 assume elevated privileges on the node with the following command:
[student@w8ks-node-0] $ | sudo –i
Answer:
Explanation:
solution
14
Certify For Sure with IT Exam Dumps
15
Certify For Sure with IT Exam Dumps
List all the pods showing name and namespace with a json path expression
Answer:
Explanation:
'metadata.namespace']}"
Answer:
Explanation:
16
Certify For Sure with IT Exam Dumps
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
Create a persistent volume with name app-data, of capacity 2Gi and access mode ReadWriteMany. The
Answer:
17
Certify For Sure with IT Exam Dumps
Explanation:
solution
Persistent Volume
resource like nodes, which don’t belong to any namespace. It is provisioned by the administrator and has a
particular file size. This way, a developer deploying their app on Kubernetes need not know the underlying
infrastructure. When the developer needs a certain amount of persistent storage for their application, the
system administrator configures the cluster so that they consume the PersistentVolume provisioned in an
easy way.
we are creating storage: 2Gi #the amount of storage we are tying to claim accessModes: # defines the
rights of the volume we are creating - ReadWriteMany hostPath: path: "/srv/app-data" # path to which we
Challenge
✑ Create a Persistent Volume named app-data, with access mode ReadWriteMany, storage classname
shared, 2Gi of storage capacity and the host path /srv/app- data.
18
Certify For Sure with IT Exam Dumps
✑ Our persistent volume status is available meaning it is available and it has not been mounted yet. This
PersistentVolumeClaim
In a real ecosystem, a system admin will create the PersistentVolume then a developer will create a
specifying the minimum size and the access mode they require from the persistentVolume. Challenge
✑ Create a Persistent Volume Claim that requests the Persistent Volume we had created above. The
claim should request 2Gi. Ensure that the Persistent Volume Claim has the same storageClassName as
spec:
storageClassName: shared
persistentvolumeclaim/app-data created
19
Certify For Sure with IT Exam Dumps
5. Create a new pod named myapp with image nginx that will be used to Mount the Persistent Volume
Mounting a Claim
Answer:
Explanation:
"sleep 3600"
List the nginx pod with custom columns POD_NAME and POD_STATUS
Answer:
Explanation:
POD_STATUS:.status.containerStatuses[].state"
Get list of all pods in all namespaces and write it to file “/opt/pods-list.yaml”
Answer:
Explanation:
20
Certify For Sure with IT Exam Dumps
23. CORRECT TEXT
✑ Add an init container to hungry-bear (which has been defined in spec file
/opt/KUCC00108/pod-spec-KUCC00108.yaml)
✑ Once the spec file has been updated with the init container definition, the pod should be created
Explanation:
solution
21
Certify For Sure with IT Exam Dumps
22
Certify For Sure with IT Exam Dumps
Task Weight: 4%
Task
Answer:
Explanation: Solution:
Score: 4%
Task
Create a pod named kucc8 with a single app container for each of the following images running inside
23
Certify For Sure with IT Exam Dumps
Answer:
Explanation:
Solution:
# 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
#12.07
Get list of all the pods showing name and namespace with a jsonpath expression.
Answer:
Explanation:
24
Certify For Sure with IT Exam Dumps
kubectl get pods -o=jsonpath="{.items[*]['metadata.name'
, 'metadata.namespace']}"
✑ Name: non-persistent-redis
The pod should launch in the staging namespace and the volume must not be persistent.
Answer:
Explanation:
solution
25
Certify For Sure with IT Exam Dumps
26
Certify For Sure with IT Exam Dumps
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.
27
Certify For Sure with IT Exam Dumps
Answer:
Explanation:
Solution:
sudo -i
Create a pod that echo “hello world” and then exists. Have the pod deleted automatically when it’s
completed
Answer:
Explanation:
kubectl get po # You shouldn't see pod with the name "busybox"
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:
solution
28
Certify For Sure with IT Exam Dumps
29
Certify For Sure with IT Exam Dumps
30
Certify For Sure with IT Exam Dumps
✑ Name: mongo
Answer:
Explanation:
solution
Score: 4%
31
Certify For Sure with IT Exam Dumps
Task
Answer:
Explanation:
Solution:
✑ Name: nginx-app
Next, deploy the application with new version 1.11.13-alpine, by performing a rolling update.
Answer:
Explanation:
solution
32
Certify For Sure with IT Exam Dumps
33
Certify For Sure with IT Exam Dumps
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
Explanation:
solution
34
Certify For Sure with IT Exam Dumps
35
Certify For Sure with IT Exam Dumps
Determine the node, the failing service, and take actions to bring up the failed service and restore the
health of the cluster. Ensure that any changes are made permanently.
You can assume elevated privileges on any node in the cluster with the following command:
[student@nodename] $ | sudo –i
Answer:
Explanation:
solution
36
Certify For Sure with IT Exam Dumps
37
Certify For Sure with IT Exam Dumps
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
38
Certify For Sure with IT Exam Dumps
39
Certify For Sure with IT Exam Dumps
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
Task
You must use kubeadm to perform this task. Any kubeadm invocations will require the use of the
--ignore-preflight-errors=all option.
Answer:
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
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.
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
40
Certify For Sure with IT Exam Dumps
✑ Client key: Topt/KUCM00302/etcd-client.key
Answer:
Explanation:
solution
Score: 7%
41
Certify For Sure with IT Exam Dumps
Task
Reconfigure the existing deployment front-end and add a port specification named http exposing port 80/tcp
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.
Answer:
Explanation:
Solution:
#service.yaml
apiVersion: v1
kind: Service
metadata:
name: front-end-svc
labels:
app: nginx
spec:
ports:
42
Certify For Sure with IT Exam Dumps
- port: 80
protocol: tcp
name: http
selector:
app: nginx
type: NodePort
Create an nginx pod and list the pod with different levels of verbosity
Answer:
Explanation:
// create a pod
Score:7%
43
Certify For Sure with IT Exam Dumps
Context
An existing Pod needs to be integrated into the Kubernetes built-in logging architecture (e.
g. kubectl logs). Adding a streaming sidecar container is a good and common way to accomplish this
requirement.
Task
Add a sidecar container named sidecar, using the busybox Image, to the existing Pod big- corp-app. The
Use a Volume, mounted at /var/log, to make the log file big-corp-app.log available to the sidecar container.
Answer:
Explanation:
Solution:
44
Certify For Sure with IT Exam Dumps
apiVersion: v1
kind: Pod
metadata:
name: big-corp-app
spec:
containers:
- name: big-corp-app
image: busybox
args:
- /bin/sh
- -c
- > i=0;
while true;
do
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: logs
mountPath: /var/log
- name: count-log-1
image: busybox
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
emptyDir: {
45
Certify For Sure with IT Exam Dumps
}
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):
Answer:
Explanation:
solution
46
Certify For Sure with IT Exam Dumps
47
Certify For Sure with IT Exam Dumps
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.
48
Certify For Sure with IT Exam Dumps
Answer:
Explanation:
49
Certify For Sure with IT Exam Dumps
Solution:
#backup
cacert=/opt/KUIN000601/ca.crt --cert=/opt/KUIN000601/etcd-client.crt --
#restore
cacert=/opt/KUIN000601/ca.crt --cert=/opt/KUIN000601/etcd-client.crt --
Answer:
Explanation:
jsonpath='{.spec.containers[].image}{"\n"}'
(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:
solution
50
Certify For Sure with IT Exam Dumps
51
Certify For Sure with IT Exam Dumps
Answer:
Explanation:
jsonpath='{.spec.containers[].image}{"\n"}'
Score: 7%
Task
• Name: ping
• Namespace: ing-internal
52
Certify For Sure with IT Exam Dumps
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
53
Certify For Sure with IT Exam Dumps
port:
number: 5678
Create and configure the service front-end-service so it's accessible through NodePort and routes to the
Answer:
Explanation:
solution
54
Certify For Sure with IT Exam Dumps
Answer:
Explanation:
Using JsonPath
items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
Score: 7%
Task
Given an existing Kubernetes cluster running version 1.20.0, upgrade all of the Kubernetes control plane
Be sure to drain the master node before upgrading it and uncordon it after the upgrade.
55
Certify For Sure with IT Exam Dumps
You are also expected to upgrade kubelet and kubectl on the master node.
Answer:
Explanation:
SOLUTION:
56
Certify For Sure with IT Exam Dumps
kubectl drain k8s-master --delete-local-data --ignore-daemonsets --force
disableexcludes=kubernetes
systemctl daemon-reload
uncordon k8s-master
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.
• 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
57
Certify For Sure with IT Exam Dumps
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
Answer:
Explanation:
solution
58
Certify For Sure with IT Exam Dumps
unable-to-access-website
Answer:
Explanation:
solution
59
Certify For Sure with IT Exam Dumps
60
Certify For Sure with IT Exam Dumps
✑ 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:
solution
61
Certify For Sure with IT Exam Dumps
62
Certify For Sure with IT Exam Dumps
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:
Solution:
# taintsnoSchedule
63
Certify For Sure with IT Exam Dumps
✑ Name: 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
Answer:
Explanation:
Solution:
64
Certify For Sure with IT Exam Dumps
65
Certify For Sure with IT Exam Dumps
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.
Answer:
Explanation:
solution
Score: 4%
66
Certify For Sure with IT Exam Dumps
Context
You have been asked to create a new ClusterRole for a deployment pipeline and bind it to a specific
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
Answer:
Explanation:
Solution:
Task should be complete on node k8s -1 master, 2 worker for this connect use command
resource=deployments,statefulsets,daemonsets
67
Certify For Sure with IT Exam Dumps
serviceaccount=default:cicd-token --namespace=app-team1
Score: 5%
Task
From the pod label name=cpu-utilizer, find pods running high CPU workloads and write the name of the pod
Answer:
Explanation: Solution:
Answer:
Explanation:
items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
68
Certify For Sure with IT Exam Dumps
Score: 4%
Task
• Name: nginx-kusc00401
• Image: nginx
Answer:
Explanation:
Solution:
#yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-kusc00401
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
disk: spinning
69
Certify For Sure with IT Exam Dumps
#
List pod logs named “frontend” and search for the pattern “started” and write it to a file “/opt/error-logs”
Answer:
Explanation:
Score:7%
Task
• Name: pv-volume
• Class: csi-hostpath-sc
• Capacity: 10Mi
• Name: web-server
• Image: nginx
70
Certify For Sure with IT Exam Dumps
Finally, using kubectl edit or kubectl patch expand the PersistentVolumeClaim to a capacity of 70Mi and
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:
71
Certify For Sure with IT Exam Dumps
- mountPath: "/usr/share/nginx/html"
name: my-volume
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: pv-volume
# craete
#edit
Answer:
Explanation:
Create a pod with image nginx called nginx and allow traffic on port 80
Answer:
Explanation:
Task Weight: 4%
72
Certify For Sure with IT Exam Dumps
Task
• Name: kucc1
• App Containers: 2
o consul
Answer:
Explanation:
Solution:
73
Certify For Sure with IT Exam Dumps
Graphical user interface, text, application
Create a namespace called 'development' and a pod with image nginx called nginx on this namespace.
Answer:
Explanation:
74