Rancher EBS - Amazon EBS storage

Hello,

There is a new entry in the catalog named “Rancher EBS - Docker volume plugin for Amazon EBS”. I deployed it with my Amazon Credentials, I tried to use it as Volume of a rancher service. Nothing happened. I cannot find any documentation of how to use it? How this Rancher EBS is working? Any doc?

1 Like

This is what I do

  1. I create the ebs storage via aws console and get the volume id “vol-xxxxxxxxxx”
  2. docker exec -it #{rancher_ebs_container_id} rancher-ebs attach ‘{“volumeID”:“vol-xxxxxxxxxx”}’
    stdout output: {“status”:“Success”,“device”:"/dev/xvdf"}
  3. On Rancher web ui, the volume status will be inactive until you mount it to containers

P.S. The volumes’ name is from
AWS tags: Name: ebs1

I create my volumes at the environment level under Infrastructure-Storage. Adding a new volume under the rancher-ebs driver with 2 driver option pairs “volumeType gp2” and “size 100” (for 100 Gig).

Then using this inside of a service map the volume name you gave it to a path in the container.

The tricky bit is that the volume will be created in the AZ of the first host that runs the service. The rancher-ebs volume thing is not smart about re-scheduling these to hosts in the same AZ as the desired volume so I added host labels with the AZs and make sure that there are scheduling rules that make the service only get scheduled into the AZ where I want the volume data.

Alternatively you can add volumeId for an existing volume created externally. (I’ve not tried this)

I also use IAM roles on the VMs that are hosts in rancher and you must make sure a policy equivalent to this is attached to their role.

    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1482260254000",
            "Effect": "Allow",
            "Action": [
                "ec2:CreateSnapshot",
                "ec2:CreateTags",
                "ec2:CreateVolume",
                "ec2:DeleteVolume",
                "ec2:AttachVolume",
                "ec2:DetachVolume",
                "ec2:DescribeSnapshots",
                "ec2:DescribeTags",
                "ec2:DescribeVolumes"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Hi all
I was able to use it. Like said “sra”, you need to déclare the volume name under Infrastructure / storage and add a minimum the key “size”

I have some questions about rancher-ebs:

  • What is the purpose of IAM profile if a use an IAM user that have the AWSadmin profile ?

  • did you successfully tested snapshot ?

Is there no way to do this through the docker compose?

–EDIT–

I figured it out

my docker compose is as follows

version: '2'

services:
    nginx:
        image: nginx:latest
        labels:
            io.rancher.container.pull_image: 'always'
        volumes:
            - test-volume:/var/lib/storage
volumes:
    test-volume:
        driver: rancher-ebs
        driver_opts:
            name: test-volume
            size: 40
            volumeType: gp2

This creates the volume