CKA Latest
CKA Latest
CKA Latest
Certification dumps
contact
Question #:1
unable-to-access-website
Explanation
solution
Question #:2
Explanation
Using JsonPath
items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
Question #:3
deployment name:kual00201
(or/opt/KUAL00201/spec_deployment.json).
When you are done, clean up (delete)any new Kubernetes API object thatyou produced during this task.
Explanation
solution
Question #:4
List pod logs named “frontend” and search for the pattern “started” and write it to a file “/opt/error-logs”
Explanation
Kubectl logs frontend | grep -i “started” > /opt/error-logs
Question #:5
Name: super-secret
password: bob
Explanation
solution
Question #:6
Create a pod with image nginx called nginx and allow traffic on port 80
Explanation
kubectlrun nginx --image=nginx --restart=Never --port=80
Question #:7
List the nginx pod with custom columns POD_NAME and POD_STATUS
Explanation
kubectl get po -o=custom-columns="POD_NAME:.metadata.name,
POD_STATUS:.status.containerStatuses[].state"
Question #:8
Name:non-persistent-redis
container Image:redis
Mount path:/data/redis
The pod should launch in thestagingnamespace and the volumemust notbe persistent.
Explanation
solution
Question #:9
Name:nginx-random
Ensure that the service & podare accessible via theirrespective DNS records
The container(s) within anypod(s) running as a part of thisdeployment should use thenginxImage
Next, use the utilitynslookupto lookup the DNS records of the service &pod and write the output to
/opt/KUNW00601/service.dnsand/opt/KUNW00601/pod.dnsrespectively.
Explanation
Solution:
Question #:10
Explanation
kubectl get pods --sort-by=.metadata.name
Question #:11
Name:nginx-app
Explanation
solution
Question #:12
From the pod labelname=cpu-utilizer, find podsrunning high CPU workloads and
Explanation
solution
Question #:13
Create a snapshot of theetcdinstance running athttps://127.0.0.1:2379, saving thesnapshot to the file path
/srv/data/etcd-snapshot.db.
CA certificate:/opt/KUCM00302/ca.crt
Client certificate:/opt/KUCM00302/etcd-client.crt
Client key:Topt/KUCM00302/etcd-client.key
Explanation
solution
Question #:14
Name:mongo
Using Image:mongo
Explanation
solution
Question #:15
Create 2 nginx image pods in which one of them is labelled with env=prod and another one labelled with
env=dev and verify the same.
Explanation
kubectl run --generator=run-pod/v1 --image=nginx -- labels=env=prod nginx-prod --dry-run -o yaml >
nginx-prodpod.yaml Now, edit nginx-prod-pod.yaml file and remove entries like “creationTimestamp: null”
“dnsPolicy: ClusterFirst”
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 :
Question #:16
Name: nginx-kusc00101
Image: nginx
Explanation
solution
Question #:17
List all the pods showing name and namespace with a json path expression
Explanation
kubectl get pods -o=jsonpath="{.items[*]['metadata.name',
'metadata.namespace']}"
Question #:18
[student@node-1] $ | sshWk8s-node-0
[student@w8ks-node-0] $ |sudo –i
Explanation
solution
Question #:19
Explanation
solution
Question #:20
Create an nginx pod and list the pod with different levels of verbosity
Explanation
// create a pod
Question #:21
Explanation
kubect1 get pods--sort-by=.metadata.creationTimestamp
Question #:22
Once the spec file has beenupdatedwith the init containerdefinition, the pod should becreated
Explanation
solution
Question #:23
Explanation
jsonpath='{.spec.containers[].image}{"\n"}'
Question #:24
Explanation
solution
Persistent Volume
A persistent volume is a piece of storage in aKubernetes cluster. PersistentVolumes are a cluster-level 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 knowthe 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.
Creating PersistentVolume
Challenge
Our persistent volume status is available meaning it is available and it has not been mounted yet. This
status willchange when we mount the persistentVolume to a persistentVolumeClaim.
PersistentVolumeClaim
In a real ecosystem, a system admin will create the PersistentVolume then a developer will create a
PersistentVolumeClaim which will be referenced in a pod. A PersistentVolumeClaim is created by 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. Ensurethat the Persistent Volume Claim has the same storageClassName as the
persistentVolume you had previously created.
spec:
accessModes:-ReadWriteManyresources:
requests:storage:2Gi
storageClassName:shared
persistentvolumeclaim/app-data created
5. Create a new pod named myapp with image nginx that will be used to Mount the Persistent Volume Claim
with the path /var/app/config.
Mounting a Claim
Question #:25
List the nginx pod with custom columns POD_NAME and POD_STATUS
Explanation
kubectl get po -o=custom-columns="POD_NAME:.metadata.name,
POD_STATUS:.status.containerStatuses[].state"
Question #:26
Create a pod with environment variables as var1=value1.Check the environment variable in pod
Explanation
kubectl run nginx --image=nginx --restart=Never --env=var1=value1
# then
# or
# or
Question #:27
For this item, you will havetosshto the nodesik8s-master-0andik8s-node-0and complete all tasks on
thesenodes. Ensure that you return tothe base node (hostname:node-1) when you havecompleted this item.
Context
As an administrator of a smalldevelopment team, you have beenasked to set up a Kubernetes clusterto test the
viability of a newapplication.
Task
You must usekubeadmto performthis task. Anykubeadminvocationswill require the use of the
--ignore-preflight-errors=alloption.
Explanation
solution
You may use any CNI pluginto complete this task, but ifyou don't have your favouriteCNI plugin's manifest
URL athand, Calico is one popularoption:https://docs.projectcalico.org/v3.14/manifests/calico.yaml
Docker is already installedon both nodes andapthasbeen configured so that you caninstall the required tools.
Question #:28
Create a namespace called 'development' and a pod with image nginx called nginx on this namespace.
Explanation
kubectl create namespace development
Question #:29
Explanation
kubect1 get pods --sort-by=.metadata.name
Question #:30
Explanation
kubect1 get pods -o wide
Question #:31
Explanation
solution
Question #:32
Explanation
solution
Question #:33
Explanation
solution
Question #:34
Get list of all pods in all namespaces and write it to file “/opt/pods-list.yaml”
Explanation
kubectl get po –all-namespaces > /opt/pods-list.yaml
Question #:35
Ensure a single instance of podnginxis running on each node of theKubernetes cluster wherenginxalso
represents the Image name whichhas to be used. Do not override anytaints currently in place.
Explanation
solution
Question #:36
Explanation
kubect1 get pods -o=jsonpath='{range
items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'
Question #:37
Explanation
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
Question #:38
Get list of all the pods showing name and namespace with a jsonpath expression.
Explanation
kubectl get pods -o=jsonpath="{.items[*]['metadata.name'
, 'metadata.namespace']}"
Question #:39
Create a pod that echo “hello world” and then exists. Have the pod deleted automatically when it’s completed
Explanation
kubectl run busybox --image=busybox -it --rm --restart=Never --
kubectl get po # You shouldn't see pod with the name "busybox"
Question #:40
Create a busybox pod that runs the command “env” and save the output to “envpod” file
Explanation
kubectl run busybox --image=busybox --restart=Never –-rm -it -- env > envpod.yaml
Question #:41
Create a file:
Explanation
solution
Question #:42
Check to see how many worker nodes are ready (not including nodes taintedNoSchedule) and write the
number to/opt/KUCC00104/kucc00104.txt.
Explanation
solution
Question #:43
Explanation
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c
"sleep 3600"
Question #:44
Configure the kubelet systemd-managed service, on the nodelabelled withname=wk8s-node-1, tolaunch a pod
containing a singlecontainer of Imagehttpdnamedwebtoolautomatically. Any spec filesrequired should be
placed in the/etc/kubernetes/manifestsdirectoryon the node.
[student@node-1] $ sshwk8s-node-1
[student@wk8s-node-1] $ |sudo –i
Explanation
solution
Question #:45
Explanation
kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o
yaml > nginx-pod.yaml
YAML File:
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: engineering
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Never
Question #:46
Determine the node, the failingservice, and take actions to bring upthe failed service and restore thehealth of
the cluster. Ensure that anychanges are made permanently.
[student@node-1] $ ssh<nodename>
You can assume elevatedprivileges on any node in thecluster with the followingcommand:
[student@nodename] $ | sudo –i
Explanation
solution
Question #:47
Set the node namedek8s-node-1asunavailable and reschedule all thepods running on it.
Explanation
solution
Question #:48
Explanation
kubect1 get po nginx-dev -o
jsonpath='{.spec.containers[].image}{"\n"}'