Allen Fung
Allen Fung

Reputation: 41

Unable to mount Amazon Web Services (AWS) EBS Volume into Kubernetes pod

I created a volume using the following command.

aws ec2 create-volume --size 10 --region us-east-1 --availability-zone us-east-1c --volume-type gp2

Then I used the file below to create a pod that uses the volume. But when I login to the pod, I don't see the volume. Is there something that I might be doing wrong? Did I miss a step somewhere? Thanks for any insights.

--- 
  kind: "Pod"
  apiVersion: "v1"
  metadata:
    name: "nginx"
    labels:
      name: "nginx"
  spec:
    containers:
      -   
    name: "nginx" 
    image: "nginx" 
    volumeMounts:
    - mountPath: /test-ebs
      name: test-volume
  volumes:
  - name: test-volume
    # This AWS EBS volume must already exist.
    awsElasticBlockStore:
      volumeID: aws://us-east-1c/vol-8499707e
      fsType: ext4

Upvotes: 4

Views: 1509

Answers (2)

Jon Mumm
Jon Mumm

Reputation: 19

Ensure that the volume is in the same availability zone as the node.

http://kubernetes.io/docs/user-guide/volumes/

If that's not the issue, are there any events in kubectl describe pod nginx?

Upvotes: 1

Lasse Schuirmann
Lasse Schuirmann

Reputation: 184

I just stumbled across the same thing and found out after some digging, that they actually changed the volume mount syntax. Based on that knowledge I created this PR for documentation update. See https://github.com/kubernetes/kubernetes/pull/17958 for tracking that and more info, follow the link to the bug and the original change which doesn't include the doc update. (SO prevents me from posting more than two links apparently.)

If that still doesn't do the trick for you (as it does for me) it's probably because of https://stackoverflow.com/a/32960312/3212182 which will be fixed in one of the next releases I guess. At least I can't see it in the latest release notes.

Upvotes: 2

Related Questions