k8s建立pod一直pending
阿新 • • 發佈:2021-07-15
什麼意思呢?什麼意思呢?
這個提示表示,沒有節點可以接受排程。
為什麼會這樣呢?
因為我們現在三個節點都是master節點,還沒有新增node節點。預設情況下,master打了汙點(taint,後續再介紹),master節點不接收排程。
由於我們這裡是測試環境,沒有多餘的機器來作為node節點,可以手動刪除master的汙點,讓master節點接收排程。
通過如下命令可以檢視taint資訊:
[root@k8s-master001 ~]# kubectl get no -o yaml | grep taint -A 5 f:taints: {} manager: kube-controller-manager operation: Update time: "2020-09-10T09:10:40Z" - apiVersion: v1 fieldsType: FieldsV1 -- taints: - effect: NoSchedule key: node-role.kubernetes.io/master status: addresses: - address: 10.26.25.20 -- f:taints: {} manager: kube-controller-manager operation: Update time: "2020-09-10T09:30:25Z" - apiVersion: v1 fieldsType: FieldsV1 -- taints: - effect: NoSchedule key: node-role.kubernetes.io/master status: addresses: - address: 10.26.25.21 -- f:taints: {} manager: kube-controller-manager operation: Update time: "2020-09-10T09:35:43Z" - apiVersion: v1 fieldsType: FieldsV1 -- taints: - effect: NoSchedule key: node-role.kubernetes.io/master status: addresses: - address: 10.26.25.22
刪除汙點`http://node-role.kubernetes.io/master`,如下所示
[root@k8s-master001 ~]# kubectl taint nodes --all node-role.kubernetes.io/master-
node/k8s-master001 untainted
node/k8s-master002 untainted
node/k8s-master003 untainted
然後現在在看nginx的狀態,已經變為ContainerCreating,這表示已經分配到節點,開始建立nginx的pod了
風拂碭林月入弦,行岸汀紫。謝謝支援~