kubernetes

1 node(s) had taints that the pod didn't tolerate in kubernetes cluster


Today my kubernetes cluster v1.15.2 give me this error: 1 node(s) had taints that the pod didn't tolerate and the pods could not start.

It tells me one nodes have taints and I check the node status and works fine, how to know it exactly have taints?

I am searching from internet and all tells me that master node could not allocate for pods running by default. But now my kubernetes pods is not running a master node.


Solution

  • You can use kubectl describe node <nodename> to check taints.

    kubectl describe node masternode
    Name:               masternode
    Roles:              master
    Labels:             beta.kubernetes.io/arch=amd64
                        beta.kubernetes.io/os=linux
                        kubernetes.io/arch=amd64
                        kubernetes.io/hostname=ip-10-0-0-115
                        kubernetes.io/os=linux
                        node-role.kubernetes.io/master=
    Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
                        node.alpha.kubernetes.io/ttl: 0
                        projectcalico.org/IPv4Address: 10.0.0.115/24
                        projectcalico.org/IPv4IPIPTunnelAddr: 192.168.217.0
                        volumes.kubernetes.io/controller-managed-attach-detach: true
    CreationTimestamp:  Thu, 18 Jun 2020 10:21:48 +0530
    Taints:             node-role.kubernetes.io/master:NoSchedule
    

    The node controller automatically taints a Node when certain conditions are true. The following taints are built in:

    Along with above a special taint node-role.kubernetes.io/master:NoSchedule is added by default to master nodes.

    The error typically comes if there is a taint on nodes for which you don't have corresponding toleration in pod spec.

    Below is an example pod with toleration.

    apiVersion: v1
    kind: Pod
    metadata:
      name: nginx
      labels:
        env: test
    spec:
      containers:
      - name: nginx
        image: nginx
        imagePullPolicy: IfNotPresent
      tolerations:
      - key: "example-key"
        operator: "Exists"
        effect: "NoSchedule"