Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将外部磁盘连接到aws群集kubernetes_Kubernetes_Amazon Ebs - Fatal编程技术网

将外部磁盘连接到aws群集kubernetes

将外部磁盘连接到aws群集kubernetes,kubernetes,amazon-ebs,Kubernetes,Amazon Ebs,我在AWS中有一个集群,在那里有一个部署。现在我想在那里连接一个外部AWS磁盘。我正在学习教程,但不知道如何在那里显示我的磁盘。代码如下: apiVersion: v1 kind: Pod metadata: name: test-ebs spec: containers: - image: k8s.gcr.io/test-webserver name: test-container volumeMounts: - mountPath: /test-ebs

我在AWS中有一个集群,在那里有一个部署。现在我想在那里连接一个外部AWS磁盘。我正在学习教程,但不知道如何在那里显示我的磁盘。代码如下:

apiVersion: v1
kind: Pod
metadata:
  name: test-ebs
spec:
  containers:
  - image: k8s.gcr.io/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /test-ebs
      name: test-volume
  volumes:
  - name: test-volume
    # This AWS EBS volume must already exist.
    awsElasticBlockStore:
      volumeID: "<volume id>"
      fsType: ext4
apiVersion:v1 种类:豆荚 元数据: 名称:测试ebs 规格: 容器: -图片:k8s.gcr.io/test-webserver 名称:测试容器 体积数量: -装载路径:/testebs 名称:测试卷 卷数: -名称:测试卷 #此AWS EBS卷必须已存在。 awsElasticBlockStore: 卷ID:“ fsType:ext4
在我看来,我应该在卷上指示我的磁盘。那么我应该在哪里获取卷id?以及如何将其连接到我的群集?

卷ID:这是将要使用的AWS卷

您可以使用AWS CLI获取分配给实例的卷ID

CLI命令:

aws ec2描述卷

有关使用
描述卷获取卷ID的信息,请参见

例如:

apiVersion: "v1"
kind: "PersistentVolume"
metadata:
  name: "pv0001" 
spec:
  capacity:
    storage: "5Gi" 
  accessModes:
    - "ReadWriteOnce"
  awsElasticBlockStore: 
    fsType: "ext4" 
    volumeID: "vol-f37a03aa" 

如果pod创建成功且卷已连接(ebs卷的状态将在AWS控制台中从“可用”变为“正在使用”),您可以只执行
kubectl Descripte pod
,它应显示在卷中,卷ID
与AWS中的类似:


希望这能回答您的问题。

我创建了该卷,但如何检查它是否已应用?