linux - 为什么 pod 状态仍然是“PENDING”?
问题描述
这是我得到的输出:
[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 已被指示申请存储空间,但是,在您的情况下,有可用的存储空间。检查您的 Podkubectl get pods <pod-name> -o yaml
并查看已应用于集群的确切 yaml。在那里,您应该能够看到 Pod 正在尝试声明 PersistentVolume (PV)。
要快速创建由hostPath
应用以下 yaml 支持的 PV:
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>
) 以立即重新安排它。
推荐阅读
- c++11 - 仅使用带有键的 unordered_map 来存储指针(忽略值)
- c - 嵌套在结构中的联合中的值未更新
- vba - 将带有文件名的 Word 文件保存为递增数字
- javascript - 如何将响应返回到控制台
- javascript - 使用 Yup 验证不需要的表单字段?
- java - 来自外部类的片段中的 SetText
- node.js - 如何将已经运行的数据库连接传递到 mongo 存储以存储会话
- asp.net - 使用 .NET Web Api 授权 .NET 5 Core MVC Web 应用程序
- c++ - 错误:变量周围的堆栈已损坏
- javascript - 异步等待 promise.all 和多个 API