master $ ls -ltr
total 12
drwxr-xr-x 2 root root 4096 May 21 12:41 Desktop
drwxr-xr-x 4 root root 4096 Jun 8 22:04 go
-rw-r--r-- 1 root root 103 Jul 14 00:42 nginx.yaml
master $ kubectl apply -f nginx.yaml
pod/nginx created
master $ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 0/1 Pending 0 4s
What is the status of the created POD?
master $ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 0/1 Pending 0 4s
Why is the POD in a pending state? Inspect the environment for various kubernetes control plane components.
master $ kubectl get pods --namespace kube-system
NAME READY STATUS RESTARTS AGE
coredns-66bff467f8-4fqx2 1/1 Running 0 5m25s
coredns-66bff467f8-4p4lf 1/1 Running 0 5m25s
etcd-master 1/1 Running 0 5m40s
katacoda-cloud-provider-58f89f7d9-jrdtb 0/1 Pending 0 5m24s
kube-apiserver-master 1/1 Running 0 5m40s
kube-controller-manager-master 1/1 Running 0 5m40s
kube-flannel-ds-amd64-ljdg5 1/1 Running 1 5m3s
kube-flannel-ds-amd64-w94gq 1/1 Running 0 5m25s
kube-keepalived-vip-whfmw 1/1 Running 0 4m43s
kube-proxy-44hxg 1/1 Running 0 5m3s
kube-proxy-w952d 1/1 Running 0 5m25s
Answer: no scheduler present
Manually schedule the pod on node01 Delete and re-create the POD if necessary
master $ kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 10m v1.18.0
node01 Ready <none> 9m34s v1.18.0
master $ vi nginx.yaml
Now edit the nginx.yaml to include node01 as the nodeName and save it
master $ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 0/1 Pending 0 8m48s
master $ kubectl delete pods nginx
pod "nginx" deleted
master $ kubectl apply -f nginx.yaml
pod/nginx created
master $ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 0/1 ContainerCreating 0 6s
master $ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 11s
Now schedule the same pod on the master node. Delete and recreate the POD if necessary
Repeat the same process as above this time changing the nodeName to master.
No comments:
Post a Comment