I have a cluster in AWS and have a deployment there. Now I want to attach an external AWS disk there. I am following the tutorial but didn't get how to indicate my disk there. Here is the code:
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
Seems to me that I should indicate my disk at volume. Where should I take volume id then? And how connect it to my cluster?
volumeID: This is the AWS volume that will be used.
You can use the AWS CLI to get the volume ID assigned to your instance.
CLI command:
aws ec2 describe-volumes
see the doc for getting the volume ID with using describe-volumes
for ex:
apiVersion: "v1"
kind: "PersistentVolume"
metadata:
name: "pv0001"
spec:
capacity:
storage: "5Gi"
accessModes:
- "ReadWriteOnce"
awsElasticBlockStore:
fsType: "ext4"
volumeID: "vol-f37a03aa"
If the pod creation was successful with the volume attached (state of the ebs volume will change from "available" to "in-use" in AWS console), you could just do a kubectl describe pod and it should show up in Volumes with VolumeID similar to what you have in AWS:
Hope this answers your question.