1. 程式人生 > 實用技巧 >0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }

0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }

root@ubuntu:~# kubectl apply -f kata-nginx.yaml 
Error from server (Forbidden): error when creating "kata-nginx.yaml": pods "kata-nginx" is forbidden: pod rejected: RuntimeClass "kata" not found
root@ubuntu:~# 

root@ubuntu:~# kubectl get nodes
NAME     STATUS   ROLES    AGE   VERSION
ubuntu   Ready    master   24m   v1.
18.1 root@ubuntu:~# kubectl get pods No resources found in default namespace. root@ubuntu:~# kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-66bff467f8-8rpxj 0/1 ContainerCreating 0 24m kube
-system coredns-66bff467f8-cmrzz 0/1 ContainerCreating 0 24m kube-system etcd-ubuntu 0/1 ContainerCreating 0 24m kube-system kube-apiserver-ubuntu 0/1 ContainerCreating 0 24m kube-system kube-controller-manager-ubuntu 0
/1 ContainerCreating 0 24m kube-system kube-flannel-ds-arm64-wlmzn 0/1 PodInitializing 0 24m kube-system kube-proxy-l8s8z 0/1 ContainerCreating 0 24m kube-system kube-scheduler-ubuntu 0/1 ContainerCreating 0 24m root@ubuntu:~#

root@ubuntu:~# kubectl apply -f kata-nginx.yaml 
pod/kata-nginx created
root@ubuntu:~# kubectl describe pod kata-nginx
Name:         kata-nginx
Namespace:    default
Priority:     0
Node:         <none>
Labels:       <none>
Annotations:  Status:  Pending
IP:           
IPs:          <none>
Containers:
  nginx:
    Image:        nginx
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7bph4 (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  default-token-7bph4:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7bph4
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  10s (x2 over 10s)  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate.
root@ubuntu:~# 

 kubectl taint nodes --all node-role.kubernetes.io/master-
root@ubuntu:~# kubectl describe pod kata-nginx
Name:         kata-nginx
Namespace:    default
Priority:     0
Node:         ubuntu/10.10.16.82
Start Time:   Wed, 14 Oct 2020 14:24:23 +0800
Labels:       <none>
Annotations:  Status:  Pending
IP:           
IPs:          <none>
Containers:
  nginx:
    Container ID:   
    Image:          nginx
    Image ID:       
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7bph4 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-7bph4:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7bph4
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  75s (x2 over 75s)  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate.
  Normal   Scheduled         8s                 default-scheduler  Successfully assigned default/kata-nginx to ubuntu
root@ubuntu:~#

kubectl delete pod kata-nginx

root@ubuntu:~# kubectl apply -f kata-nginx.yaml 
pod/kata-nginx created
root@ubuntu:~# kubectl describe pod kata-nginx
Name:         kata-nginx
Namespace:    default
Priority:     0
Node:         ubuntu/10.10.16.82
Start Time:   Wed, 14 Oct 2020 14:26:40 +0800
Labels:       <none>
Annotations:  Status:  Pending
IP:           
IPs:          <none>
Containers:
  nginx:
    Container ID:   
    Image:          nginx
    Image ID:       
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7bph4 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-7bph4:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7bph4
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  9s    default-scheduler  Successfully assigned default/kata-nginx to ubuntu