Task 1: Identify and Troubleshoot the Problematic Pod
First, identify which pod is not in a “Ready” state. Several pods are deployed across various namespaces. Run the following command to list all pods:nginx1401 in the dev1401 namespace—by running:
nginx1401.yaml) and then run:
Ensure your pod configuration settings (such as
containerPort) match across all probe definitions to avoid inconsistencies.Task 2: Create a CronJob Named “dice”
The next task involves creating a CronJob called “dice” that runs every minute. This job leverages thekodekloud/throw-dice image, which randomly returns a number between one and six. A roll of six indicates success; any other result is a failure.
Additional requirements for the CronJob include:
- Running jobs non-parallel (in series).
- Completing the task only once (completions: 1).
- Using a backoff limit of 25.
- Terminating the job if it runs longer than 20 seconds (using
activeDeadlineSeconds: 20). - Setting the restart policy to
Never.
dice-job.yaml:
Task 3: Create a “my-busybox” Pod in a Specific Namespace
In this task, you will create a pod named “my-busybox” using thebusybox image in the dev2406 namespace. The pod requirements are as follows:
- The container inside the pod should be named
secretand executesleep 3600. - Mount a read-only secret volume named
secret-volumeat/etc/secret-volume. (The secretdotfile-secretis pre-created.) - Schedule the pod on the control plane by specifying
nodeName: controlplane.
my-busybox.yaml file to include the required customizations:
Task 4: Create an Ingress Resource for Virtual Hosting Routing
This task involves creating a single Ingress resource namedingress-vh-routing to handle virtual hosting routing for HTTP traffic. The configuration will route traffic as follows:
- Requests to
watch.ecom-store.comwith the path/videowill be directed to thevideo-serviceon port 8080. - Requests to
apparels.ecom-store.comwith the path/wearwill be directed to theapparels-serviceon port 8080.
ingress.yaml with the following content:
For more details on configuring Ingress resources, visit Ingress in Kubernetes.
Task 5: Inspect Pod Logs and Redirect Warnings
For the final task, inspect the logs of a pod in thedefault namespace that contains a container named log-x. Your goal is to redirect any warning messages to a file located at /opt/warnings.log on the control plane node.
First, list the pods to identify the target pod:
dev-pod-dind-878516, execute the following command to filter and redirect warning messages:
Make sure you have the necessary permissions to write to
/opt/ on the control plane node.This concludes all tasks for Lightning Lab Two. Follow each step carefully to ensure proper configuration and successful task completion. Happy Kubernetes troubleshooting! For more Kubernetes tips and documentation, check out the Kubernetes Documentation.