This repository consists of examples for the AWS Controllers for Kubernetes (ACK). ACK allows you to create AWS Resources on your behalf from Kubernetes Clusters with simple Kubernetes YAML files.
-
A Kubernetes Cluster
-
AWS IAM Permissions for creating and attaching IAM Roles
-
Installation of required tools:
If you don't have a Kubernetes cluster, you can create an EKS cluster with Terraform using the example codes within this repository.
Terraform codes in this repository uses Amazon EKS Blueprints for Terraform
Terraform codes in this repository creates following resources:
-
VPC with 6 subnets (3 Private, 3 Public)
-
EKS Cluster with Kubernetes version set to 1.22
-
EKS Managed Node group
You can update the Terraform codes according to your requirements and environment.
terraform init
terraform plan
terraform apply --auto-approve
PS:
- These resources are not Free Tier eligible.
- You need to configure AWS Authentication for Terraform with either Environment Variables or AWS CLI named profiles.
You can connect to your cluster using this command:
aws eks --region <region> update-kubeconfig --name <cluster_name>
You need to change
region
andcluster_name
parameters.
When you want to install a Service Controller and configure IAM Permissions you can run ./ack_controller_install.sh <service_name>
and change the service_name accordingly.
The script has two functions called install and permissions.
-
Install function downloads the required Helm Chart from the official AWS Registry installs it to the Kubernetes cluster.
-
Permissions function creates OIDC identity provider for the Kubernetes cluster and creates IAM Roles for for Service Accounts of the Service Controllers.
When you want to delete all the resources created in this repository, you can run ./cleanup.sh <service_name>
script in the root directory of this repository and change the service_name accordingly.
The script has one function and does the following:
-
Uninstalls the Helm Chart for Service Controller
-
Deletes the CRDs created for Service Controller
-
Deletes the OIDC Provider of EKS Cluster
-
Deletes the EKS Cluster created with Terraform