CramPDF Co., ltd provides valid exam cram PDF & dumps PDF materials to help candidates pass exam certainly. If you want to get certifications in the short time please choose CramPDF exam cram or dumps PDF file.

CKA Exam Practice Questions prepared by Linux Foundation Professionals [Q12-Q32]

Share

CKA Exam Practice Questions prepared by Linux Foundation Professionals

Use Valid New CKA Questions - Top choice Help You Gain Success


The CKA exam is a hands-on, performance-based exam that requires candidates to perform tasks on a live Kubernetes cluster. CKA exam lasts for two hours and consists of 24 performance-based tasks. Candidates must complete all tasks within the allocated time frame to pass the exam. CKA exam is proctored, and candidates must have a webcam to ensure the integrity of the exam.


The CKA exam is a hands-on, practical test that requires candidates to perform tasks on a live Kubernetes cluster. CKA exam is conducted online and comprises of 24 performance-based tasks that must be completed within 3 hours. To pass the exam, candidates must score 74% or higher. The CKA certification is valid for three years, after which candidates can renew their certification by passing a recertification exam. The CKA program provides a proven path to career advancement and recognition as a Kubernetes expert.

 

NEW QUESTION # 12
Monitor the logs of pod foo and:
* Extract log lines corresponding to error
unable-to-access-website
* Write them to/opt/KULM00201/foo

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 13
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.

Answer:

Explanation:
Create a second pod named pod-secrets-via-env, using the redis Image, which exports password as CONFIDENTIAL See the solution below.
Explanation
solution



NEW QUESTION # 14
For this item, you will have to ssh and complete all tasks on these
nodes. Ensure that you return to the base node (hostname: ) 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.

Answer:

Explanation:
See the solution below.
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 # 15
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 # 16
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 # 17
Get the list of pods of webapp deployment

  • A. // Get the label of the deployment
    kubectl get deploy --show-labels
    kubectl get pods -l app=webapp
  • B. // Get the label of the deployment
    kubectl get deploy --show-labels
    // Get the pods with that label
    kubectl get pods -l app=webapp

Answer: B


NEW QUESTION # 18
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.

Answer:

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 # 19
Schedule a pod as follows:
Name: nginx-kusc00101
Image: nginx
Node selector: disk=ssd

Answer:

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

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

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


NEW QUESTION # 20
Score: 4%

Task
Schedule a pod as follows:
* Name: nginx-kusc00401
* Image: nginx
* Node selector: disk=ssd

Answer:

Explanation:
See the solution below.
Explanation
Solution:
#yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-kusc00401
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
disk: spinning
#
kubectl create -f node-select.yaml


NEW QUESTION # 21
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:
See the solution below.
Explanation
solution
F:\Work\Data Entry Work\Data Entry\20200827\CKA\3 B.JPG

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

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

F:\Work\Data Entry Work\Data Entry\20200827\CKA\3 E.JPG


NEW QUESTION # 22
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 # 23
Score:7%

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 new sidecar container has to run the following command:
/bin/sh -c tail -n+1 -f /va r/log/big-corp-app.log
Use a Volume, mounted at /var/log, to make the log file big-corp-app.log available to the sidecar container.

Answer:

Explanation:
Solution:
#
kubectl get pod big-corp-app -o yaml
#
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
echo "$(date) INFO $i" >> /var/log/big-corp-app.log;
i=$((i+1));
sleep 1;
done
volumeMounts:
- name: logs
mountPath: /var/log
- name: count-log-1
image: busybox
args: [/bin/sh, -c, 'tail -n+1 -f /var/log/big-corp-app.log']
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
emptyDir: {
}
#
kubectl logs big-corp-app -c count-log-1


NEW QUESTION # 24
Create a busybox pod which executes this command sleep 3600 with the service account admin and verify

  • A. kubectl run busybox --image=busybox --restart=Always --dry-run
    -o yaml -- /bin/sh -c "sleep 3600" > busybox.yml
    // Edit busybox.yaml file
    apiVersion: v1
    kind: Pod
    metadata:
    creationTimestamp: null
    labels:
    run: busybox
    name: busybox
    spec:
    serviceAccountName: admin
    containers:
    - args:
    - /bin/sh
    - -c
    - sleep 3600
    image: busybox
    name: busybox
    restartPolicy: Always
    // verify
    K kubectl describe po busybox
  • B. kubectl run busybox --image=busybox --restart=Always --dry-run
    -o yaml -- /bin/sh -c "sleep 3600" > busybox.yml
    // Edit busybox.yaml file
    apiVersion: v1
    kind: Pod
    metadata:
    creationTimestamp: null
    labels:
    run: busybox
    name: busybox
    spec:
    serviceAccountName: admin
    containers:
    - args:
    - /bin/sh
    - -c
    - sleep 3800
    image: busybox
    name: busybox
    restartPolicy: Always
    // verify
    K kubectl describe po busybox

Answer: A


NEW QUESTION # 25
Scale the deploymentwebserverto6pods.

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 26
Resume the rollout of the deployment

Answer:

Explanation:
kubectl rollout resume deploy webapp


NEW QUESTION # 27
Evict all existing pods from a node-1 and make the node unschedulable for new pods.

  • A. kubectl get nodes
    kubectl drain node-1 #It will evict pods running on node-1 to
    other nodes in the cluster
    // Verify
    kubectl get no
    When you cordon a node, the status shows "SchedulingDisabled"
  • B. kubectl get nodes
    kubectl drain node-1 #It will evict pods running on node-1 to
    other nodes in the cluster
    kubectl cordon node-1 # New pods cannot be scheduled to the
    node
    // Verify
    kubectl get no
    When you cordon a node, the status shows "SchedulingDisabled"

Answer: B


NEW QUESTION # 28
Create a persistent volume with name app-data, of capacity 2Gi and access mode ReadWriteMany. The type of volume is hostPath and its location is /srv/app-data.

Answer:

Explanation:
solution
Persistent Volume
A persistent volume is a piece of storage in a Kubernetes 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 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.
Creating Persistent Volume
kind: PersistentVolume apiVersion: v1 metadata: name:app-data spec: capacity: # defines the capacity of PV 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 are creating the volume 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.

2. Save the file and create the persistent volume.

3. View the persistent volume.

Our persistent volume status is available meaning it is available and it has not been mounted yet. This status will change 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. Ensure that the Persistent Volume Claim has the same storageClassName as the persistentVolume you had previously created.
kind: PersistentVolume apiVersion: v1 metadata: name:app-data
spec:
accessModes: - ReadWriteMany resources:
requests: storage: 2Gi
storageClassName: shared
2. Save and create the pvc
njerry191@cloudshell:~ (extreme-clone-2654111)$ kubect1 create -f app-data.yaml persistentvolumeclaim/app-data created
3. View the pvc

4. Let's see what has changed in the pv we had initially created.

Our status has now changed from available to bound.
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
apiVersion: v1 kind: Pod metadata: creationTimestamp: null name: app-data spec: volumes: - name:congigpvc persistenVolumeClaim: claimName: app-data containers: - image: nginx name: app volumeMounts: - mountPath: "/srv/app-data " name: configpvc


NEW QUESTION # 29
Check to see how many worker nodes are ready (not including nodes taintedNoSchedule) and write the number to/opt/KUCC00104/kucc00104.txt.

Answer:

Explanation:
See the solution below.
Explanation
solution


NEW QUESTION # 30
// Create a configmap
kubectl create configmap redis-config --from-file=/opt/redisconfig
// Verify
kubectl get configmap redis-config -o yaml
// first run this command to save the pod yml
kubectl run redis-pod --image=redis --restart=Always --dry-run
-o yaml > redis-pod.yml
// edit the yml to below file and create
apiVersion: v1
kind: Pod
metadata:
name: redis
spec:
containers:
- name: redis
image: redis
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: example-redis-config

  • A. items:
    - key: redis-config
    path: redis.conf
    cf
    // // Verify
    K kubectl exec -it redis - cat /redis-master-data/redis.conf
  • B. items:
    - key: redis-config
    path: redis.conf
    cf
    kk kubectl apply -f redis-pod.yml
    // // Verify
    K kubectl exec -it redis - cat /redis-master-data/redis.conf

Answer: B


NEW QUESTION # 31
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

Answer:

Explanation:
solution


NEW QUESTION # 32
......


The CKA certification is highly valued in the industry, and it is recognized by top companies such as Google, Microsoft, and Amazon. Certified Kubernetes Administrator (CKA) Program Exam certification demonstrates that the candidate has a deep understanding of Kubernetes and can manage large-scale Kubernetes deployments. Certified Kubernetes Administrator (CKA) Program Exam certification also enhances the candidate's career prospects and opens up opportunities for higher-paying jobs.

 

CKA Exam Practice Materials Collection: https://www.crampdf.com/CKA-exam-prep-dumps.html

Get Latest and 100% Accurate CKA Exam Questions: https://drive.google.com/open?id=1cnovKMyfMna1-yC_i6gJ_PZVFVlL2WBC