Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 1.6 KB

03-Practice-Test-Manual-Scheduling.md

File metadata and controls

71 lines (53 loc) · 1.6 KB

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?
    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

    ---
    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
          OR
    kubectl replace -f nginx.yaml --force (one single cmd will delete and create)
    
  5. Now schedule the same pod on the controlplane node.

    Repeat the steps as per the previous question. Edit nodeName to be controlplane