Create Kubernetes cluster on Amazon Elastic Kubernetes Service (EKS)¶
This guide will walk you through creating a Kubernetes cluster on Amazon Elastic Kubernetes Service (EKS). You’ll learn how to configure your environment, create a cluster, and set up your nodes.
Prerequisites¶
Before creating an EKS cluster, ensure the following tools are set up:
-
AWS Command Line Interface (AWS CLI): This tool allows you to interact with AWS services from your terminal. Install the AWS CLI.
-
eksctl: A command-line tool to simplify the creation and management of EKS clusters. Install eksctl.
-
kubectl: The Kubernetes command-line tool for managing and deploying applications. Install kubectl.
-
Configure AWS CLI: Ensure your AWS CLI is configured with your credentials. AWS CLI.
Create the EKS cluster¶
Important
To run a 3-node PXC cluster, you need at least a 3-node EKS cluster with 2 vCPUs available per node. The database will not be created if you attempt to create a database cluster in a Kubernetes cluster without sufficient resources.
To create the EKS cluster, do the following steps:
-
Set up your cluster details
Before creating your cluster, determine the following details:
- Cluster Name: Choose a name for your EKS cluster.
- AWS Region: Specify the AWS region where you want to deploy your cluster.
- Number of Nodes: Decide how many nodes you need.
- On-Demand and Spot Instances: Determine the desired ratio between on-demand and spot instances in the total number of nodes.
Note
Spot instances are not recommended for production environment but may be useful for testing purposes.
-
Create Your EKS Cluster
Use the following
eksctl
command to create your cluster:Example:
eksctl create cluster --name my-cluster --region region-code --version 1.28 --vpc-private-subnets subnet-ExampleID1,subnet-ExampleID2 --without-nodegroup
- name: The name of your cluster.
- region: The AWS region where the cluster will be deployed.
- version: The Kubernetes version for your cluster.
- vpc-private-subnets: The private subnets where the nodes will be deployed.
- without-nodegroup: Creates the cluster without a default node group. You will add nodes later.
For more detailed options and instructions, refer to the official EKS cluster creation documentation.
-
Install the Amazon EBS CSI driver on your cluster.
See the official documentation on adding it as an Amazon EKS add-on.
3.1 Create your Amazon EBS CSI plugin IAM role with eksctl
eksctl create iamserviceaccount \ --name ebs-csi-controller-sa \ --namespace kube-system \ --cluster $cluster_name \ --role-name AmazonEKS_EBS_CSI_DriverRole \ --role-only \ --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \ --approve
3.2 Add the Amazon EBS CSI add-on using eksctl. (Replace 111122223333 with your account ID)
eksctl create addon --name aws-ebs-csi-driver --cluster my-cluster --service-account-role-arn arn:aws:iam::111122223333:role/AmazonEKS_EBS_CSI_DriverRole --force
-
Add nodes to your EKS cluster
Here’s an example using a managed node group:
eksctl create nodegroup \ --cluster my-cluster \ --region region-code \ --name my-mng \ --node-ami-family ami-family \ --node-type m5.large \ --nodes 3 \ --nodes-min 2 \ --nodes-max 3 \ --ssh-access \ --ssh-public-key my-key
Next Steps¶
Now that your Kubernetes cluster is running, you might want to deploy Percona Everest. Follow our quick install guide to get started quickly and easily.
Get expert help¶
If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.