为什么容器状态保持"待处理"?



这是我得到的输出:

[root@ip-10-0-3-103 ec2-user]# kubectl get pod --namespace=migration
NAME                                          READY   STATUS    RESTARTS   AGE
clear-nginx-deployment-cc77649fb-j8mzj        0/1     Pending   0          118m
clear-nginx-deployment-temp-cc77649fb-hxst2   0/1     Pending   0          41s

无法理解json:中显示的消息

*"status": 
{
"conditions": [
{
"message": "0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.",
"reason": "Unschedulable",
"status": "False",
"type": "PodScheduled"
}
],
"phase": "Pending",
"qosClass": "BestEffort"
}*

如果你能帮我渡过难关的话。前面关于stackoverflow的问题没有回答我的问题,因为我的消息输出不同。

这是因为您的Pod已被指示申请存储,但在您的情况下,有可用的存储。使用kubectl get pods <pod-name> -o yaml检查您的Pods,并查看已应用于集群的确切yaml。在那里,您应该能够看到Pod正在尝试声明PersistentVolume(PV(。

要快速创建由hostPath支持的PV,请应用以下yaml:

apiVersion: v1
kind: PersistentVolume
metadata:
name: stackoverflow-hostpath
namespace: migration
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"

Kubernetes将成倍地尝试再次调度Pod;为了加快速度,请删除您的一个pod(kubectl delete pods <pod-name>(以立即重新安排。

最新更新