Skip to content

Commit

Permalink
Merge pull request #748 from aws-samples/ebs-addon
Browse files Browse the repository at this point in the history
update: User installs EBS CSI addon
  • Loading branch information
niallthomson authored Nov 15, 2023
2 parents d45ddae + cea4206 commit fc6453a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
15 changes: 15 additions & 0 deletions manifests/modules/fundamentals/storage/ebs/.workshop/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

check=$(aws eks list-addons --cluster-name $EKS_CLUSTER_NAME --query "addons[? @ == 'aws-ebs-csi-driver']" --output text)

kubectl delete namespace catalog --wait --ignore-not-found > /dev/null

if [ ! -z "$check" ]; then
echo "Deleting EBS CSI driver addon..."

aws eks delete-addon --cluster-name $EKS_CLUSTER_NAME --addon-name aws-ebs-csi-driver > /dev/null

aws eks wait addon-deleted --cluster-name $EKS_CLUSTER_NAME --addon-name aws-ebs-csi-driver > /dev/null
fi
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,8 @@ module "ebs_csi_driver_irsa" {
tags = local.tags
}

module "eks_blueprints_addons" {
source = "aws-ia/eks-blueprints-addons/aws"
version = "1.9.2"

cluster_name = local.eks_cluster_id
cluster_endpoint = local.eks_cluster_endpoint
cluster_version = local.eks_cluster_version
oidc_provider_arn = local.eks_oidc_provider_arn

eks_addons = {
aws-ebs-csi-driver = {
most_recent = true
service_account_role_arn = module.ebs_csi_driver_irsa.iam_role_arn
preserve = false
}
}
}
output "environment" {
value = <<EOF
export EBS_CSI_ADDON_ROLE="${module.ebs_csi_driver_irsa.iam_role_arn}"
EOF
}
11 changes: 8 additions & 3 deletions website/docs/fundamentals/storage/ebs/ebs-csi-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ The [Kubernetes Container Storage Interface (CSI)](https://kubernetes-csi.github

In order to utilize Amazon EBS volumes with dynamic provisioning on our EKS cluster, we need to confirm that we have the EBS CSI Driver installed. [The Amazon Elastic Block Store (Amazon EBS) Container Storage Interface (CSI) driver](https://github.com/kubernetes-sigs/aws-ebs-csi-driver) allows Amazon Elastic Kubernetes Service (Amazon EKS) clusters to manage the lifecycle of Amazon EBS volumes for persistent volumes.

> Optional:
> To learn how to install the Amazon EBS CSI driver on a non-workshop cluster, follow the instructions in our documentation.
To improve security and reduce the amount of work, you can manage the Amazon EBS CSI driver as an Amazon EKS add-on. The IAM role needed by the addon was created for us so we can go ahead and install the addon:

As part of our workshop environment, the EKS cluster has pre-installed the EBS CSI Driver. We can confirm the installation by running the following command:
```bash timeout=300 wait=60
$ aws eks create-addon --cluster-name $EKS_CLUSTER_NAME --addon-name aws-ebs-csi-driver \
--service-account-role-arn $EBS_CSI_ADDON_ROLE
$ aws eks wait addon-active --cluster-name $EKS_CLUSTER_NAME --addon-name aws-ebs-csi-driver
```

Now we can take a look at what has been created in our EKS cluster by the addon. For example, a DaemonSet will be running a pod on each node in our cluster:

```bash
$ kubectl get daemonset ebs-csi-node -n kube-system
Expand Down
2 changes: 1 addition & 1 deletion website/docs/fundamentals/storage/ebs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ prepare-environment fundamentals/storage/ebs
```

This will make the following changes to your lab environment:
- Install the EKS managed addon for the EBS CSI driver
- Create the IAM role needed for the EBS CSI driver addon

You can view the Terraform that applies these changes [here](https://github.com/VAR::MANIFESTS_OWNER/VAR::MANIFESTS_REPOSITORY/tree/VAR::MANIFESTS_REF/manifests/modules/fundamentals/storage/ebs/.workshop/terraform).

Expand Down

0 comments on commit fc6453a

Please sign in to comment.