k8s.github.io

Practice Test - Manual Scheduling

Solutions to Practice Test - Manual Scheduling

  1. A pod definition file nginx.yaml is given. Create a pod using the file. ``` kubectl create -f nginx.yaml ```
  2. What is the status of the created POD? ``` kubectl get pods ``` Examine the `STATUS` column
  3. Why is the POD in a pending state?</br>Inspect the environment for various kubernetes control plane components. ``` kubectl get pods --namespace kube-system ``` There is a key pod missing here!
  4. Manually schedule the pod on node01. We will have to delete and recereate the pod, as the only property that may be edited on a running container is `image` ``` vi nginx.yaml ``` Make the following edit ```yaml --- apiVersion: v1 kind: Pod metadata: name: nginx spec: nodeName: node01 # add this line containers: - image: nginx name: nginx ``` ``` kubectl delete -f nginx.yaml kubectl create -f nginx.yaml ```
  5. Now schedule the same pod on the controlplane node. Repeat the steps as per the previous question. Edit `nodeName` to be `controlplane`

</details>