Create an AWS Kubernetes Cluster
Pro Tip
To create the cluster, we definitely recommend you use
eksctl
. It will undoubtedly make your life simpler.We recommend against using the AWS web console, as changes made there are hard to track and replicate.
Create an AWS Kubernetes cluster using eksctl
eksctl
For eksctl
to work, it also needs the AWS CLI installed.
- Install the AWS CLI. Instructions on how to do that are available on the AWS documentation website.
You can configure the AWS CLI using the
aws configure
command.
-
Install
eksctl
. Read more on how you can do this on the eksctl website. -
Create a cluster definition yaml file by following the instructions provided in this documentation.
You might face the following error while creating the cluster:
Unable to connect to the server: getting credentials: exec plugin is configured to use API version client.authentication.k8s.io/v1alpha1, plugin returned version client.authentication.k8s.io/v1beta1.
In such cases, you can install the AWS EKS vended kubectl (linked here), then run the command
cat ~/.kube/config
and update the API version line respectively.
- Add the cluster to your
kubectl
configuration by downloading the config from AWS using the following command:
aws eks update-kubeconfig --region {REGION_CODE} --name {CLUSTER_NAME}
Replace the
{REGION_CODE}
and{CLUSTER_NAME}
with the newly created clusters details.
- When connecting the cluster to Bunnyshell, you have to provide the following:
- Cluster name
- AWS Cluster name
- Cluster URL
- Certificate
- Access Key ID
- Secret Access Key
By default the configuration will be downloaded to ~/.kube/config-file-name
. View this file and extract the relevant information provided below:
- AWS Cluster name: Corresponds to the
name
of the cluster.
Extract only the first part, egbunnyshell-demo-cluster
.
- cluster:
certificate-authority-data: <very-long-encoded-text-here>
...
name: bunnyshell-demo-cluster.eu-west-1.eksctl.io
- Cluster URL: Corresponds to the
cluster.server
key in the below example.
- cluster:
certificate-authority-data: <very-long-encoded-text-here>
server: https://2E34896AD30433FAB54DB2F7A984F5C1.gr7.eu-west-1.eks.amazonaws.com
...
- Certificate: Corresponds to the
cluster.certificate-authority-data
in the below example.
- cluster:
certificate-authority-data: <very-long-encoded-text-here>
server: https://2E34896AD30433FAB54DB2F7A984F5C1.gr7.eu-west-1.eks.amazonaws.com
...
- Access Key ID and Secret Access Key are needed to programmatically obtain a token for cluster access.
These can be found in the~/.aws/credentials
file after you have run theaws configure
command provided above.
Updated 5 months ago