Practice Test - Manual Scheduling
Solutions to Practice Test - Manual Scheduling
-
A pod definition file nginx.yaml is given. Create a pod using the file.
```
kubectl create -f nginx.yaml
```
-
What is the status of the created POD?
```
kubectl get pods
```
Examine the `STATUS` column
-
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!
-
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
```
-
Now schedule the same pod on the controlplane node.
Repeat the steps as per the previous question. Edit `nodeName` to be `controlplane`
</details>