AWS-EKS ¶
Cluster.dev uses stack templates to generate users' projects in a desired cloud. AWS-EKS is a stack template that creates and provisions Kubernetes clusters in AWS cloud by means of Amazon Elastic Kubernetes Service (EKS).
On this page you will find guidance on how to create an EKS cluster on AWS using one of the Cluster.dev prepared samples – the AWS-EKS stack template. Running the example code will have the following resources created:
-
EKS cluster with addons:
-
cert-manager
-
ingress-nginx
-
external-dns
-
argocd
-
-
AWS IAM roles for EKS IRSA cert-manager and external-dns
-
(optional, if you use cluster.dev domain) Route53 zone
.cluster.dev -
(optional, if vpc_id is not set) VPC for EKS cluster
Prerequisites ¶
-
Terraform version 1.4+
-
AWS account
-
AWS CLI installed
-
kubectl installed
Authentication ¶
Cluster.dev requires cloud credentials to manage and provision resources. You can configure access to AWS in two ways:
Info
Please note that you have to use IAM user with granted administrative permissions.
-
Environment variables: provide your credentials via the
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
, the environment variables that represent your AWS Access Key and AWS Secret Key. You can also use theAWS_DEFAULT_REGION
orAWS_REGION
environment variable to set a region, if needed. Example usage: -
Shared Credentials File (recommended): set up an AWS configuration file to specify your credentials.
Credentials file
~/.aws/credentials
example:Config:
~/.aws/config
example:Then export
AWS_PROFILE
environment variable.
Install AWS client ¶
If you don't have the AWS CLI installed, refer to AWS CLI official installation guide, or use commands from the example:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws s3 ls
Create S3 bucket ¶
Cluster.dev uses S3 bucket for storing states. Create the bucket with the command:
DNS Zone ¶
In the AWS-EKS stack template example, you need to define a Route 53 hosted zone. Options:
-
You already have a Route 53 hosted zone.
-
Create a new hosted zone using a Route 53 documentation example.
-
Use "cluster.dev" domain for zone delegation.
Create project ¶
-
Configure access to AWS and export required variables.
-
Create locally a project directory, cd into it and execute the command:
This will create a new, empty project. -
Edit variables in the example's files, if necessary:
-
project.yaml
- main project config. Sets common global variables for the current project such as organization, region, state bucket name etc. See project configuration docs. -
backend.yaml
- configures backend for Cluster.dev states (including Terraform states). Uses variables fromproject.yaml
. See backend docs. -
stack.yaml
- describes stack configuration. See stack docs.
-
-
Run
cdev plan
to build the project. In the output you will see an infrastructure that is going to be created after runningcdev apply
.Note
Prior to running
cdev apply
make sure to look through thestack.yaml
file and replace the commented fields with real values. If you would like to use existing VPC and subnets, uncomment preset options and set the correct VPC ID and subnets' IDs. If you leave them as is, Cluster.dev will have VPC and subnets created for you. -
Run
cdev apply
Tip
We highly recommend running
cdev apply
in a debug mode so that you can see the Cluster.dev logging in the output:cdev apply -l debug
-
After
cdev apply
is successfully executed, in the output you will see the ArgoCD URL of your cluster. Sign in to the console to check whether ArgoCD is up and running and that the stack template has been deployed correctly. To sign in, use the "admin" login and the bcrypted password that you have generated for thestack.yaml
. -
Displayed in the output will also be a command on how to get kubeconfig and connect to your Kubernetes cluster.
-
Destroy the cluster and all created resources with the command
cdev destroy