Amazon Web Services - Create an EKS cluster
This page offers step-by-step guidance to manually create an EKS cluster using the eksctl
tool with the minimum requirements to run AGILITY in High Availability mode.
Requirements
To properly run the application, the cluster must include the following:
A load balancer controller, preferably the AWS Load Balancer Controller
A block storage dynamic provisioner using the Amazon Elastic Block Store (EBS) CSI driver
Prerequisites
eksctl
Helm
Create the Cluster
Run the following to generate the cluster definition (adjust the zone if needed)
export CLUSTER_NAME="demo-cluster" export AWS_REGION="us-west-2" export ACCOUNT_ID=$(aws sts get-caller-identity --output text --query Account) cat <<EOF | tee ${CLUSTER_NAME}.yaml --- apiVersion: eksctl.io/v1alpha5 kind: ClusterConfig metadata: name: ${CLUSTER_NAME} region: us-west-2 version: "1.24" availabilityZones: ["us-west-2a", "us-west-2b", "us-west-2c"] managedNodeGroups: - name: nodegroup minSize: 4 maxSize: 6 desiredCapacity: 4 instanceType: t3.2xlarge ssh: enableSsm: true # To enable all of the control plane logs, uncomment below: # cloudWatch: # clusterLogging: # enableTypes: ["*"] EOF
Execute
eksctl
.eksctl create cluster -f ${CLUSTER_NAME}.yaml
You may have to wait ~10 mins before the cluster is ready.
Install AWS Load Balancer Controller
Reference: Installing the AWS Load Balancer Controller add-on - Amazon EKS.
Create the policy to access LB service from K8s.
export LBC_VERSION="v2.4.5" export LBC_CHART_VERSION="1.4.6" eksctl utils associate-iam-oidc-provider \ --region ${AWS_REGION} \ --cluster ${CLUSTER_NAME} \ --approve curl -o iam_policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/${LBC_VERSION}/docs/install/iam_policy.json aws iam create-policy \ --policy-name AWSLoadBalancerControllerIAMPolicy \ --policy-document file://iam_policy.json eksctl create iamserviceaccount \ --cluster ${CLUSTER_NAME} \ --namespace kube-system \ --name aws-load-balancer-controller \ --attach-policy-arn arn:aws:iam::${ACCOUNT_ID}:policy/AWSLoadBalancerControllerIAMPolicy \ --override-existing-serviceaccounts \ --approve
Install the chart
Check the controller is deployed
Run a test application
Wait 3 minutes and check the URL generated by the controller.
From the example, the page will be available here: http://k8s-game2048-ingress2-bcac0b5b37-1216204772.us-west-2.elb.amazonaws.com.
Amazon EBS CSI driver
Reference: Amazon EBS CSI driver - Amazon EKS.
Create a policy to allow EBS access.
Configure IAM Role for Service Account.
3- Deploy the Amazon EBS CSI Driver.
4- Run a test pod
Agility Deployment
Follow the Operator installation steps here.
Cleaning up
1- Remove Agility workloads here.
2- Delete the resources.
3- Delete the cluster.
4- Delete the policies.