diff --git a/manifests/modules/fundamentals/storage/ebs/.workshop/cleanup.sh b/manifests/modules/fundamentals/storage/ebs/.workshop/cleanup.sh new file mode 100644 index 000000000..de833c1d8 --- /dev/null +++ b/manifests/modules/fundamentals/storage/ebs/.workshop/cleanup.sh @@ -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 \ No newline at end of file diff --git a/manifests/modules/fundamentals/storage/ebs/.workshop/terraform/addon.tf b/manifests/modules/fundamentals/storage/ebs/.workshop/terraform/addon.tf index 5585e733b..63ec16908 100644 --- a/manifests/modules/fundamentals/storage/ebs/.workshop/terraform/addon.tf +++ b/manifests/modules/fundamentals/storage/ebs/.workshop/terraform/addon.tf @@ -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 - } - } -} \ No newline at end of file +output "environment" { + value = < 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 diff --git a/website/docs/fundamentals/storage/ebs/index.md b/website/docs/fundamentals/storage/ebs/index.md index 3503a41fd..3de63beac 100644 --- a/website/docs/fundamentals/storage/ebs/index.md +++ b/website/docs/fundamentals/storage/ebs/index.md @@ -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).