【发布时间】:2021-03-06 00:22:06
【问题描述】:
信息:
- Kubernetes 服务器版本:1.14
- AWS 云提供商
- EBS 卷、存储类
详情: 我已经在我们的 kubernetes 集群中安装了 statefulset,但是,它停留在“ContainerCreating”状态。检查日志后,错误为“AttachVolume.Attach failed for volume pvc-xxxxxx: error Finding instance ip-xxxxx : “instance not found”
大约 17 天前安装成功,但重新安装更新导致 pod 卡在 ContainerCreating 中。
手动将卷附加到实例有效。但是通过存储类来做这件事是行不通的,并且卡在了 ContainerCreating 状态。
存储类:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
name: ssd-default
allowVolumeExpansion: true
parameters:
encrypted: "true"
type: gp2
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete
volumeBindingMode: Immediate
pvc yaml:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
pv.kubernetes.io/bind-completed: "yes"
pv.kubernetes.io/bound-by-controller: "yes"
volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
finalizers:
- kubernetes.io/pvc-protection
labels:
app.kubernetes.io/instance: thanos-store
app.kubernetes.io/name: thanos-store
name: data-thanos-store-0
namespace: thanos
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
storageClassName: ssd-default
volumeMode: Filesystem
volumeName: pvc-xxxxxx
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 3Gi
phase: Bound
pv yaml:
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
kubernetes.io/createdby: aws-ebs-dynamic-provisioner
pv.kubernetes.io/bound-by-controller: "yes"
pv.kubernetes.io/provisioned-by: kubernetes.io/aws-ebs
finalizers:
- kubernetes.io/pv-protection
labels:
failure-domain.beta.kubernetes.io/region: ap-xxx
failure-domain.beta.kubernetes.io/zone: ap-xxx
name: pvc-xxxx
spec:
accessModes:
- ReadWriteOnce
awsElasticBlockStore:
fsType: ext4
volumeID: aws://xxxxx
capacity:
storage: 3Gi
claimRef:
apiVersion: v1
kind: PersistentVolumeClaim
name: data-athena-thanos-store-0
namespace: thanos
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/region
operator: In
values:
- ap-xxx
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- ap-xxx
persistentVolumeReclaimPolicy: Delete
storageClassName: ssd-default
volumeMode: Filesystem
status:
phase: Bound
描述pvc:
Name: data-athena-thanos-store-0
Namespace: athena-thanos
StorageClass: ssd-encrypted
Status: Bound
Volume: pvc-xxxx
Labels: app.kubernetes.io/instance=athena-thanos-store
app.kubernetes.io/name=athena-thanos-store
Annotations: pv.kubernetes.io/bind-completed: yes
pv.kubernetes.io/bound-by-controller: yes
volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
Finalizers: [kubernetes.io/pvc-protection]
Capacity: 3Gi
Access Modes: RWO
VolumeMode: Filesystem
Mounted By: athena-thanos-store-0
【问题讨论】:
-
两个问题: 1. 你能分享你当前的配置(PV 和 PVC yamls)吗? 2. 使用 Kubernetes 1.14 版本有什么特别的原因吗?
-
您好@WytrzymałyWiktor,回答:1. 我更新了我的问题,包括存储类的yamls 和使用pvc 的应用程序yaml。我们正在使用存储类。 2. 集群很旧,升级它是最不重要的
-
您能否用
kubectl describe pvc data-thanos-store-0描述 pvc 并用结果编辑您的问题? -
您好@WytrzymałyWiktor,我更新了我的帖子,我在描述pvc时添加了详细信息,状态已绑定但pod容器仍停留在“ContainerCreating”状态。
标签: kubernetes amazon-ec2 kubernetes-pod amazon-ebs