Amazon EKS
Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service provided by AWS. Customize and manage the full lifecycle of Amazon EKS clusters in any region using GitOps automation and an intuitive self-service wizard based workflow.
Credentials¶
Ensure you have created valid cloud credentials for the controller to manage the lifecycle of Amazon EKS clusters on your behalf in your AWS account.
Automation Pipelines¶
The RCTL CLI can be easily embedded and integrated into your preferred platform for automation pipelines. Here is an illustrative example of a Jenkins based pipeline that uses RCTL to provision an Amazon EKS Cluster based on the provided cluster specification.
Examples¶
Multiple ready to use examples of cluster specifications are maintained and provided in this Public Git Repo.
Create Cluster¶
Imperative¶
Create an EKS cluster object in the configured project in the Controller. You can optionally also specify the cluster blueprint during this step.
To create an EKS cluster, region and cloud credentials name are mandatory. If not specified, the default cluster blueprint will be used.
./rctl create cluster eks eks-cluster sample-credentials --region us-west-2
To create an EKS cluster with a custom blueprint
./rctl create cluster eks eks-cluster sample-credentials --region us-west-2 -b standard-blueprint
Declarative¶
You can also create an EKS cluster based on a version controlled cluster spec that you can manage in a Git repository. This enables users to develop automation for reproducible infrastructure.
./rctl create cluster eks -f cluster-spec.yml
An illustrative example of the cluster spec YAML file for EKS is shown below
kind: Cluster
metadata:
# cluster labels
labels:
env: dev
type: eks-workloads
name: eks-cluster
project: defaultproject
spec:
type: eks
blueprint: default
cloudprovider: dev-credential # Name of the cloud credential object created on the Controller
---
apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-cluster
region: us-west-1
version: "1.18"
tags:
'demo': 'true'
nodeGroups:
- name: nodegroup-1
instanceType: t3.xlarge
desiredCapacity: 1
volumeType: gp3
volumeSize: 50
privateNetworking: true
Get Cluster Details¶
Once the cluster has been created, use this command to retrieve details about the cluster.
./rctl get cluster cluster-name
An example for a successfully provisioned and operational cluster is shown below.
+--------------+-----------------------------+---------+--------+-----------+----------------------------+----------+
| NAME | CREATED AT | TYPE | STATUS | BLUEPRINT | PROVISION | COMMENTS |
+--------------+-----------------------------+---------+--------+-----------+----------------------------+----------+
| cluster-name | 2021-02-20T00:05:10.425154Z | aws-eks | READY | default | CLUSTER_PROVISION_COMPLETE | |
+--------------+-----------------------------+---------+--------+-----------+----------------------------+----------+
Node Groups¶
Both Managed and Self Managed node groups are supported.
Add Node Groups¶
You can add a new node group (Spot or Standard) to an existing EKS cluster. Here is an example YAML file to add a spot node group to an existing EKS cluster.
apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-cluster
region: us-west-1
nodeGroups:
- name: spot-ng-1
minSize: 2
maxSize: 4
volumeType: gp3
instancesDistribution:
maxPrice: 0.030
instanceTypes: ["t3.large","t2.large"]
onDemandBaseCapacity: 0
onDemandPercentageAboveBaseCapacity: 0
spotInstancePools: 2
To add a spot node group to an existing cluster based on the config shown above.
./rctl create node-group -f eks-nodegroup.yaml
Scale Nodegroup¶
To Scale an existing nodegroup in a cluster
./rctl scale node-group nodegroup-name cluster-name --desired-nodes <node-count>
Drain Nodegroup¶
To drain a nodegroup in a cluster
./rctl drain node-group nodegroup-name cluster-name
Delete Nodegroup¶
To delete a nodegroup from an existing cluster
./rctl delete node-group nodegroup-name cluster-name
Delete Cluster¶
This will delete the EKS cluster and all associated resources in AWS.
./rctl delete cluster eks-cluster