Real CKA Exam Questions are the Best Preparation Material
Practice on 2025 LATEST CKA Exam Updated 122 Questions
NEW QUESTION # 28
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).
Answer:
Explanation:
See the solution below.
Explanation
Solution:
kubectl top -l name=cpu-user -A
echo 'pod name' >> /opt/KUT00401/KUT00401.txt
NEW QUESTION # 29
Create 5 nginx pods in which two of them is labeled env=prod and
three of them is labeled env=dev
- A. kubectl run nginx-dev1 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-dev2 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-dev3 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-prod1 --image=nginx --restart=Never --
labels=env=prod
kubectl run nginx-prod2 --image=nginx --restart=Never --
labels=env=prod - B. kubectl run nginx-dev1 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-dev2 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-prod1 --image=nginx --restart=Never --
labels=env=prod
kubectl run nginx-prod2 --image=nginx --restart=Never --
labels=env=prod
Answer: A
NEW QUESTION # 30
Update the deployment with the image version 1.17.4 and verify
- A. kubectl set image deploy/webapp nginx=nginx:1.17.4
//Verify
kubectl describe deploy webapp | grep Image
kubectl get deploy -
{.metadata.name}{"\t"}{.spec.template.spec.containers[*].i
mage}{"\n"}' - B. kubectl set image deploy/webapp nginx=nginx:1.17.4
//Verify
kubectl describe deploy webapp | grep Image
kubectl get deploy -o=jsonpath='{range.items [*]}{.[*]}
{.metadata.name}{"\t"}{.spec.template.spec.containers[*].i
mage}{"\n"}'
Answer: B
NEW QUESTION # 31
A Deployment named 'my-app-deployment' is experiencing frequent crashes. You suspect that a specific container within the Deployment is causing the crashes. How would you use Kubernetes tools and techniques to isolate and debug the problematic container?
Answer:
Explanation:
See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1. Examine Pod Logs:
- Use "kubectl logs ' (where is the name of a crashing pod) to examine the logs from all containers within the pod. Look for error messages, unusual patterns, or indications of failing processes.
- Analyze the log messages carefully to identify which container is likely causing the crashes.
2. Investigate Pod Events:
- Use "kubectl describe pod ' to view the pod's events.
- Look for events that might indicate a specific container is crashing or encountering issues during startup. Events will include timestamps and reasons for the events.
3. Check Container Resource Limits:
- Use 'kubectl describe pod to check the resource requests and limits defined for each container within the pod.
- If the limits are too low, the containers might be being throttled or running out of resources, leading to crashes.
4. Use a Debugger:
- If you have access to the application code and a debugger (like a remote debugger in your development environment), you can attach to the problematic container to get more detailed information about its state and execution.
- Use the 'kubectl exec' command to access a container's shell, and then run the debugger.
5. Consider Health Checks:
- Ensure that the containers have proper health checks defined (e.g., liveness probes or readiness probes).
- Health checks can help Kubernetes identify failing containers and restart them or remove them from service.
6. Isolate the Container:
- If you suspect that the container itself is faulty, try isolating it by temporarily disabling the problematic container from the pod. You can do this by either:
- Removing the container from the Pod definition: Temporarily modify the Deployment to remove the problematic container.
- Stopping the container: Use 'kubectl exec' to access the pod's shell, and then stop the container.
7. Monitor and Repeat:
- After isolating the container, monitor the Deployment to see if the crashes stop.
- If the crashes are resolved, the isolated container was likely the cause. You can then focus on troubleshooting the container itself.
NEW QUESTION # 32
Clean the cluster by deleting deployment and hpa you just created
Answer:
Explanation:
kubectl delete deploy webapp kubectl delete hpa webapp
NEW QUESTION # 33
Print all pod name and all image name and write it to a file
name "/opt/pod-details.txt"
Answer:
Explanation:
kubectl get pods -o=custom-columns='Pod Name:metadata.name','Image:spec.containers[*].image' > /opt/pod-details.txt
NEW QUESTION # 34
You are running a Kubernetes cluster with a NodePort service exposing a web application on port 80. You want to access the web application from a client machine outside the cluster. However, the client machine is behind a NAT gateway and you cannot directly configure firewall rules on the gateway. How can you configure the Kubernetes cluster to allow the client machine to access the web application?
Answer:
Explanation:
See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1. Create a NodePort Service:
- Create a NodePort service that exposes port 80 of the web application on a specific NodePort (for example,
30080).
- Code:
2. Configure NAT Gateway: - Configure the NAT gateway to forward traffic from the client machine's IP address and port to the Kubernetes cluster's IP address and the NodePort. - Note: This configuration will depend on the specific NAT gateway and its configuration options. 3. Access the Application: - On the client machine, access the web application by using the Kubernetes cluster's IP address and the NodePort. - Example: 'http://:30080'
NEW QUESTION # 35
Create a Pod nginx and specify both CPU, memory requests and limits together and verify.
- A. kubectl run nginx-request --image=nginx --restart=Always --dryrun -o yaml > nginx-request.yml
// add the resources section and create
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
resources:
requests:
memory: "100Mi"
cpu: "0.4"
limits:
memory: "200Mi"
cpu: "7"
restartPolicy: Always
k kubectl apply -f nginx-request.yaml
// Verify
Kubectl top po - B. kubectl run nginx-request --image=nginx --restart=Always --dryrun -o yaml > nginx-request.yml
// add the resources section and create
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx-request
spec:
containers:
- image: nginx
name: nginx
resources:
requests:
memory: "100Mi"
cpu: "0.5"
limits:
memory: "200Mi"
cpu: "1"
restartPolicy: Always
k kubectl apply -f nginx-request.yaml
// Verify
Kubectl top po
Answer: B
NEW QUESTION # 36
Check the rollout history and make sure everything is ok after the update
- A. kubectl rollout history deploy webapp
kubectl get deploy webapp --show-labels
kubectl get rs -
kubectl get po -l app=webapp - B. kubectl rollout history deploy webapp
kubectl get deploy webapp --show-labels
kubectl get rs -l app=webapp
kubectl get po -l app=webapp
Answer: B
NEW QUESTION # 37
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).
Answer:
Explanation:
See the solution below.
Explanation
solution
F:\Work\Data Entry Work\Data Entry\20200827\CKA\16 B.JPG
F:\Work\Data Entry Work\Data Entry\20200827\CKA\16 C.JPG
NEW QUESTION # 38
An Administrator is configuring Authentication Enforcement and they would like to create an exemption rule to exempt a specific group from authentication. Which authentication enforcement object should they select?
- A. default-web-form
- B. default-no-captive-port
- C. default-browser-challenge
- D. default-authentication-bypass
Answer: B
NEW QUESTION # 39
You are managing a Kubernetes cluster with a very specific RBAC setup.
- Users in the "engineering" group can create Pods in the "dev" namespace, but only if the Pod's name starts with "frontend".
- Users in the "security" group can view events in the "prod" namespace, but only if the event's reason is "Failed".
Create a YAML file to define a custom resource and define its permissions for the "engineering" and "security" groups.
Answer:
Explanation:
See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1 Create the "dev" and "prod" namespaces:
kubectl create namespace dev
kubectl create namespace prod
2. Define a Custom Resource Definition (CRD) for "pod-events":
3. Define the "engineering-pod-creation" role:
4. Create the "engineering-pod-creation" role binding:
5. Define the "security-event-view" role:
6. Create the "security-event-view" role binding:
7. Apply the YAML file to the cluster: kubectl apply -f rbac-config.yaml
NEW QUESTION # 40
Undo/Rollback deployment to specific revision "1"
- A. // Check Deployment History
kubectl rollout history deployment webapp
kubectl rollout undo deploymet webapp --to-revision=1 - B. // Check Deployment History
kubectl rollout history deployment webapp
//Rollback to particular revision
kubectl rollout undo deploymet webapp --to-revision=1
Answer: B
NEW QUESTION # 41
Create a nginx pod with label env=test in engineering namespace
Answer:
Explanation:
kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o yaml > nginx-pod.yaml kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry-run -o yaml | kubectl create -n engineering -f - YAML File:
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: engineering
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
restartPolicy: Never
kubectl create -f nginx-pod.yaml
NEW QUESTION # 42
Create a deployment as follows:
* Name:nginx-random
* Exposed via a servicenginx-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.
Answer:
Explanation:
See the solution below.
Explanation
Solution:


NEW QUESTION # 43
A Service named my-service' is exposed on port 80 of your Kubernetes cluster. You need to access the service from a specific node in the cluster using its internal IP address. How can you find the internal IP address of the node running a pod associated with 'my-service'?
Answer:
Explanation:
See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1. Identify the Pod:
- Use 'kubectl get pods -l service=my-service' to list the pods associated with the 'my-service' service. Note the name of the pod.
2. Get the Pod's Node:
- Use 'kubectl describe pod (where is the name of the pod from step 1) to get the details of the pod.
- Look for the 'Node' field, which indicates the node where the pod is running.
3. Get the Node's Internal IP:
- Use 'kubectl get nodes (where is the name of the node from step 2) to get the node details.
- Look for the 'InternallP' field to find the internal IP address of the node.
4. Access the Service:
- Now you can access the 'my-service' service from the identified node using its internal IP address and the service's port (80):
- 'http://:80' (replace with the internal IP obtained in step 3).
5. Important Note: Internal IP addresses are only accessible within the Kubernetes cluster. If you need to access the service from outside the cluster, you'll need to use a public IP or expose the service through a LoadBalancer or Ingress.
NEW QUESTION # 44
......
Authentic CKA Exam Dumps PDF - Feb-2025 Updated: https://troytec.test4engine.com/CKA-real-exam-questions.html