- Jared Hocutt (@jaredhocutt)
- Dan Clark (@dmc5179)
This guide describes the steps required to install and configure the AWS EBS CSI driver on OpenShift 4.4.
Out of the box, the AWS EBS CSI driver does not work due to being unable to
access the AWS metadata endpoint (i.e. 169.254.169.254). To work around the
issue, the pods that get deployed need to set hostNetwork: true
and then
workaround a couple of issues that arise by making that change.
The details of the root cause are captured in this Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1718389
-
You must be logged into the OpenShift cluster.
-
You must already have Helm 3 installed.
See here for details: https://helm.sh/docs/intro/install/
-
You must have AWS credentials (access key and secret key) that you would like the AWS EBS CSI driver to use when communicating with the AWS API.
The permissions attached to the credentials you are using should meet the following minimum permissions.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:AttachVolume", "ec2:CreateSnapshot", "ec2:CreateTags", "ec2:CreateVolume", "ec2:DeleteSnapshot", "ec2:DeleteTags", "ec2:DeleteVolume", "ec2:DescribeAvailabilityZones", "ec2:DescribeInstances", "ec2:DescribeSnapshots", "ec2:DescribeTags", "ec2:DescribeVolumes", "ec2:DescribeVolumesModifications", "ec2:DetachVolume", "ec2:ModifyVolume" ], "Resource": "*" } ] }
-
Create secret
aws-secret.yaml
that contains your AWS credentials by setting the values forstringData.key_id
andstringData.access_key
.apiVersion: v1 kind: Secret metadata: name: aws-secret namespace: kube-system stringData: key_id: "" access_key: ""
-
Apply the secret.
oc apply -f aws-secret.yaml
The AWS EBS CSI driver does not work out-of-the-box on OpenShift and the deployment requires slight modification to make it work. Therefore, the AWS EBS CSI driver should be installed using the Helm chart as it is easier to modify than the operator.
-
Download the AWS EBS CSI driver Helm chart.
curl -LO https://github.com/kubernetes-sigs/aws-ebs-csi-driver/releases/download/v0.5.0/helm-chart.tgz
-
Unpack the Helm chart so you can make modifications.
tar xvf helm-chart.tgz
Example output:
aws-ebs-csi-driver/ aws-ebs-csi-driver/values.yaml aws-ebs-csi-driver/templates/ aws-ebs-csi-driver/templates/_helpers.tpl aws-ebs-csi-driver/templates/csidriver.yaml aws-ebs-csi-driver/templates/deployment.yaml aws-ebs-csi-driver/templates/rbac.yaml aws-ebs-csi-driver/templates/statefulset.yaml aws-ebs-csi-driver/templates/serviceaccount.yaml aws-ebs-csi-driver/templates/NOTES.txt aws-ebs-csi-driver/templates/daemonset.yaml aws-ebs-csi-driver/.helmignore aws-ebs-csi-driver/Chart.yaml
-
Edit
aws-ebs-csi-driver/templates/daemonset.yaml
and make the following modifications.-
Change the
containerPort
forhealthz
of theebs-plugin
container on line 55 from9808
to19808
.Before:
ports: - name: healthz containerPort: 9808 protocol: TCP
After:
ports: - name: healthz containerPort: 19808 protocol: TCP
-
Add argument
--health-port=19808
to theliveness-probe
container after the--csi-address=/csi/csi.sock
argument on line 88.Before:
args: - --csi-address=/csi/csi.sock
After:
args: - --csi-address=/csi/csi.sock - --health-port=19808
-
-
Edit
aws-ebs-csi-driver/templates/deployment.yaml
and make the following modifications.-
Change the
containerPort
forhealthz
of theebs-plugin
container on line 73 from9808
to29808
.Before:
ports: - name: healthz containerPort: 9808 protocol: TCP
After:
ports: - name: healthz containerPort: 29808 protocol: TCP
-
Add argument
--health-port=29808
to theliveness-probe
container after the--csi-address=/csi/csi.sock
argument on line 145.Before:
args: - --csi-address=/csi/csi.sock
After:
args: - --csi-address=/csi/csi.sock - --health-port=29808
-
Configure Pod to use
hostNetwork
by addinghostNetwork: true
in the Podspec
on line 23.Before:
spec: nodeSelector:
After:
spec: hostNetwork: true nodeSelector:
-
-
Repack the Helm chart.
tar czvf helm-chart-new.tgz aws-ebs-csi-driver/
-
Deploy the modified AWS EBS CSI driver Helm chart.
helm install aws-ebs-csi-driver ./helm-chart-new.tgz \ --namespace kube-system \ --set enableVolumeScheduling=true \ --set enableVolumeResizing=true \ --set enableVolumeSnapshot=true
-
Create StorageClass
ebs-sc.yaml
.--- kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: annotations: storageclass.kubernetes.io/is-default-class: "true" name: ebs-sc provisioner: ebs.csi.aws.com volumeBindingMode: Immediate
-
Apply the StorageClass.
oc apply -f ebs-sc.yaml