How can I list the taints on Kubernetes nodes?

前端 未结 11 1536
别那么骄傲
别那么骄傲 2021-01-30 08:47

The docs are great about explaining how to set a taint on a node, or remove one. And I can use kubectl describe node to get a verbose description of one node, inclu

11条回答
  •  别那么骄傲
    2021-01-30 09:11

    You can use kubectl's go-template output options to help you here,

    kubectl get nodes -o go-template='{{range .items}}{{if $x := index .metadata.annotations "scheduler.alpha.kubernetes.io/taints"}}{{with $x := index .metadata.name}}{{.}}{{printf "\n"}}{{end}}{{end}}{{end}}'

    On my cluster, this prints my masters, which are tainted:

    kubemaster-1.example.net
    kubemaster-2.example.net
    kubemaster-3.example.net
    

提交回复
热议问题