gpt4 book ai didi

kubernetes - K8的mongodb容器无法使用EBS卷安装

转载 作者:行者123 更新时间:2023-12-02 12:12:42 25 4
gpt4 key购买 nike

我有以下Pod定义。

apiVersion: v1
kind: Pod
metadata:
name: mongodb
spec:
volumes:
- name: mongodb-data
awsElasticBlockStore:
volumeID: vol-0c0d9800c22f8c563
fsType: ext4
containers:
- image: mongo
name: mongodb
volumeMounts:
- name: mongodb-data
mountPath: /data/db
ports:
- containerPort: 27017
protocol: TCP

我在AWS中创建了volumne,并尝试将其安装到容器。容器未启动。
kubectl get po
NAME READY STATUS RESTARTS AGE
mongodb 0/1 ContainerCreating 0 6m57s

当我创建该卷并将其分配到该节点正在运行且在该节点上调度了pod的可用区时,该卷已成功安装。如果未在节点上调度Pod,则挂载将失败。如何确保所有节点都可以访问该卷

最佳答案

根据documentation:

There are some restrictions when using an awsElasticBlockStore volume:

  • the nodes on which Pods are running must be AWS EC2 instances
  • those instances need to be in the same region and availability-zone as the EBS volume
  • EBS only supports a single EC2 instance mounting a volume


确保满足以上所有条件。如果您的节点位于不同的区域中,则可能需要创建其他EBS卷,例如:
aws ec2 create-volume --availability-zone=eu-west-1a --size=10 --volume-type=gp2

请让我知道是否有帮助。

关于kubernetes - K8的mongodb容器无法使用EBS卷安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60990154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com