Kubernetes遇到StatefulSet和3个PersistentVolumes的麻烦 [英] Kubernetes trouble with StatefulSet and 3 PersistentVolumes

查看:109
本文介绍了Kubernetes遇到StatefulSet和3个PersistentVolumes的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建StatefulSet 的"nofollow noreferrer>,它将具有3个副本.我希望3个Pod中的每一个都连接到不同的PersistentVolume.

I'm in the process of creating a StatefulSet based on this yaml, that will have 3 replicas. I want each of the 3 pods to connect to a different PersistentVolume.

对于持久卷,我正在使用3个看起来像这样的对象,只是名称更改了(pvvolume,pvvolume2,pvvolume3):

For the persistent volume I'm using 3 objects that look like this, with only the name changed (pvvolume, pvvolume2, pvvolume3):

kind: PersistentVolume
apiVersion: v1
metadata:
  name: pvvolume
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/nfs"
  claimRef:
    kind: PersistentVolumeClaim
    namespace: default
    name: mongo-persistent-storage-mongo-0

在StatefulSet中创建的三个Pod中的第一个似乎没有问题.

The first of the 3 pods in the StatefulSet seems to be created without issue.

第二个失败,并显示错误pod has unbound PersistentVolumeClaims Back-off restarting failed container.

The second fails with the error pod has unbound PersistentVolumeClaims Back-off restarting failed container.

但是,如果我转到显示PersistentVolumeClaims的选项卡,则创建的第二个似乎成功.

Yet if I go to the tab showing PersistentVolumeClaims the second one that was created seems to have been successful.

如果成功,为什么吊舱认为它失败了?

If it was successful why does the pod think it failed?

推荐答案

我希望3个Pod中的每一个都连接到不同的PersistentVolume.

I want each of the 3 pods to connect to a different PersistentVolume.

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆