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.
Correct Answer:
See the solution below. Explanation solution F:\Work\Data Entry Work\Data Entry\20200827\CKA\10 B.JPG F:\Work\Data Entry Work\Data Entry\20200827\CKA\10 C.JPG
Question 69
One of the nodes in your Kubernetes cluster is experiencing high CPU usage, which is affecting the performance of the entire cluster. The node is running multiple pods, and you need to identify which pod is responsible for the high CPU consumption and take steps to resolve the issue.
Correct Answer:
See the solution below with Step by Step Explanation. Explanation: Solution (Step by Step) : 1. Identify the High-CPU Node: - Use 'kubectl top nodes' to view the CPU usage of each node in the cluster. - Identify the node that is experiencing the high CPU usage. 2. List Pods on the Node: - Use 'kubectl get pods -R to list all pods in the cluster. - Filter the pods to find those running on the high-CPU node. - For example, 'kubectl get pods -A I grep 3. Monitor Pod CPU Usage: - Use 'kubectl top pod -n to view the CPU usage of each pod running on the node. - Pay attention to the CPU usage metrics for each container within the pod. 4. Examine Pod Logs: - Use "kubectl logs -f to view the logs of the suspected high-CPU pod. - Search for any error messages, stack traces, or other indications that the pod is experiencing excessive CPU utilization. 5. Analyze Pod Resource Requests and Limits: - Check the pod's resource requests and limits using 'kubectl describe pod - Ensure that the pod is not requesting or using significantly more CPU resources than it needs. - If the CPU requests are too high, the pod might be consuming excessive CPU even when idle. 6. Troubleshooting Options: - Based on the analysis of the logs and resource usage: - Adjust resource limits: If the pod is requesting too much CPU, reduce its CPU requests and limits in the Deployment YAML. - Optimize container images: Use a smaller container image to reduce the resource footprint. - Improve application code: Identify and address any inefficient code that is causing high CPU usage. - Scale down the pod replicas: If the pod's workload is high, reduce the number of replicas to distribute the load across fewer pods. - Consider using a different pod scheduling strategy: For example, use a node selector or taint to run the pod on a dedicated node with more resources. 7. Monitor and Adjust: - After making changes to the pod's resources or configuration, monitor the node's CPU usage: - Use 'kubectl top nodes' and 'kubectl top pod' to observe the impact of the changes. - Adjust the configuration further if needed: Continue to optimize the pod's resource usage to bring the node's CPU usage back to a healthy level.