同 k8s+virtual-kubelet部署带动态pv的pod到openstack-zun
具体创建过程参考
k8s+virtual-kubelet部署带动态pv的pod到openstack-zun
pod处于pending状态
查看pod列表
# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
testpvcpod 0/1 Pending 0 22s <none> <none> <none> <none>
查看出问题的pod详细信息,问题出在调度上,调度失败的原因有两个
这个问题的原因是4个master和1个普通node都有taint,本例主要验证使用两个virtual-kubelet node部署pod,所以这儿不做修改
该问题是本例要解决的问题
# kubectl describe pods testpvcpod
...
Events:Type Reason Age From Message---- ------ ---- ---- -------Warning FailedScheduling <unknown> default-scheduler persistentvolumeclaim "testpvc" not foundWarning FailedScheduling <unknown> default-scheduler persistentvolumeclaim "testpvc" not foundWarning FailedScheduling <unknown> default-scheduler 0/6 nodes are available: 2 node(s) had volume node affinity conflict, 4 node(s) had taints that the pod didn't tolerate.Warning FailedScheduling <unknown> default-scheduler 0/6 nodes are available: 2 node(s) had volume node affinity conflict, 4 node(s) had taints that the pod didn't tolerate.
# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
testpvc Bound pvc-c9e46b6b-cd52-474d-9835-8f5757ac5ec7 2Gi RWO standard 26m
[root@k8s-m1 test]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-c9e46b6b-cd52-474d-9835-8f5757ac5ec7 2Gi RWO Delete Bound default/te stpvc standard 26m
可以看到pv和pvc信息都正常创建了
从pv详细信息中,pv有节点亲和的需求
Node Affinity:Required Terms:Term 0: failure-domain.beta.kubernetes.io/zone in
# kubectl describe pv pvc-c9e46b6b-cd52-474d-9835-8f5757ac5ec7
Name: pvc-c9e46b6b-cd52-474d-9835-8f5757ac5ec7
Labels: failure-domain.beta.kubernetes.io/zone=nova
Annotations: kubernetes.io/createdby: cinder-dynamic-provisionerpv.kubernetes.io/bound-by-controller: yespv.kubernetes.io/provisioned-by: kubernetes.io/cinder
Finalizers: [kubernetes.io/pv-protection]
StorageClass: standard
Status: Bound
Claim: default/testpvc
Reclaim Policy: Delete
Access Modes: RWO
VolumeMode: Filesystem
Capacity: 2Gi
Node Affinity:Required Terms:Term 0: failure-domain.beta.kubernetes.io/zone in [nova]
Message:
Source:Type: Cinder (a Persistent Disk resource in OpenStack)VolumeID: 9ac04a59-146c-4300-9030-58c1e153c2f1FSType:ReadOnly: falseSecretRef: nil
Events: <none>
通过第三节分析,pv有节点亲和的需求
所以需要给节点打上相应的标签
# kubectl label node virtual-kubelet failure-domain.beta.kubernetes.io/zone=nova
node/virtual-kubelet labeled
# kubectl delete -f testpvc.yaml
pod "testpvcpod" deleted# kubectl apply -f testpvc.yaml
pod/testpvcpod created
persistentvolumeclaim/testpvc created
# kubectl get pods
NAME READY STATUS RESTARTS AGE
testpvcpod 1/1 Running 0 4m29s
本文发布于:2024-02-03 04:41:21,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170690648148713.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |