2

我创建了一个大小为 30 GiB 的 EBS 卷。制作了两个清单文件:

  • pv-ebs.yml
  • pvc-ebs.yml

在 pv-ebs.yml 中:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: ebs
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  awsElasticBlockStore:
    fsType: ext4
    # The EBS volume ID
    volumeID: vol-111222333aaabbbccc

在 pvc-ebs.yml 中

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: prometheus-prometheus-alertmanager
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  selector:
    matchLabels:
      release: "stable"

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: prometheus-prometheus-server
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  selector:
    matchLabels:
      release: "stable"

使用helm安装它:helm install --name prometheus stable/prometheus

但在 k8s 仪表板上,收到消息:

prometheus-prometheus-alertmanager-3740839786-np7kb
No nodes are available that match all of the following predicates:: NoVolumeZoneConflict (2).

prometheus-prometheus-server-3176041168-m3w2g
PersistentVolumeClaim is not bound: "prometheus-prometheus-server" (repeated 2 times)

我的方法有什么问题吗?

豆荚

在此处输入图像描述

持久卷

在此处输入图像描述

4

2 回答 2

2

创建 EBS 时,它是在特定 AZ 中配置的,不能跨区域挂载。如果您在同一区域中没有可用于调度 pod 的节点,它将不会启动。

另一件事是,使用正确配置的 kube 集群,您根本不需要自己创建 PV,只需创建 PVC 并让动态配置就可以了。

于 2017-11-28T09:48:18.207 回答
0

如果您使用 KOP 安装集群,则会自动为您创建 PV。只需等待几分钟并刷新您的屏幕。错误会消失。

如果您以另一种方式设置集群,您希望在 AWS ec2 create-volume 中创建卷,然后创建 PV,然后当 helm 运行时,它将声明这些 PV。

于 2018-02-20T13:24:56.577 回答