Building an IPv6-based Amazon EKS Cluster for Globally Scalable Applications
Deploy a preconfigured Amazon EKS cluster optimized for extra-large, global applications using an eksctl "quickstart" template.
About | |
---|---|
✅ AWS experience | 200 - Intermediate |
⏱ Time to complete | 30 minutes |
🧩 Prerequisites | - AWS Account |
📢 Feedback | Any feedback, issues, or just a 👍 / 👎 ? |
⏰ Last Updated | 2023-08-30 |
Note that if you're still within your initial 12-month AWS Free Tier period, certain Amazon EC2 instances for managed node groups and additional AWS services may not be included, and charges may apply based on your usage.
- Install the latest version of kubectl. To check your version, run:
kubectl version --short
. - Install the latest version of eksctl. To check your version, run:
eksctl info
.
- Public/Private Networking: The cluster is configured to use the IPv6 IP family, offering a broad range of globally routable IP addresses. By default, Amazon EKS sets up a public endpoint for the managed Kubernetes API server, enabling access via tools like kubectl. For those looking to enhance security, you have the option to configure the cluster API endpoint to be private. This restricts all communication between nodes and the API server to within the Virtual Private Cloud (VPC), eliminating direct exposure to the public internet. With the support for IPv6, this setup provides a flexible networking environment that can be tailored to various access control needs: public access, private access within a VPC, or a combination of both.
- Add-ons: Latest versions of the following add-ons: "vpc-cni" enable the Amazon VPC Container Network Interface, "coredns" facilitates DNS resolution, and "kube-proxy" maintains network rules on each Amazon EC2 node.
- Authentication: An OpenID Connect (OIDC) endpoint for authentication within the Amazon EKS cluster to enable communication between Kubernetes pods and AWS services.
- Node Lifecycle Management: Managed node groups simplify the handling of Amazon EC2 instances, registering them as Kubernetes nodes. This configuration employs
m6i.xlarge
andm6a.xlarge
Amazon Linux 2 (AL2) instance types, optimized for Amazon Linux 2 (AL2). The configuration balances resources, specifying a volume size of "100" and type "gp3". Node groups are tailored with a minimum size of "1" and a maximum size of "3," facilitating manual scaling. Volume encryption enhances security, while custom labels (e.g., “os-distribution: amazon-linux-2”) enhance manageability, allowing the identification and categorization of nodes, and ensuring their alignment with the intended AL2 distribution.
cluster-config.yaml
file, you'll define the settings for IPv6 networking, public and private access, managed node groups, essential add-ons, and security features like volume encryption. These configurations are essential for ensuring that the cluster is robust, flexible, and secure, with optimized performance for a long-term solution to the IP exhaustion problem and efficient resource management.- Create a
cluster-config.yaml
file and paste the following contents into it. Replace the sampleregion
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: ipv6-quickstart
version: "1.27"
region: us-east-2
kubernetesNetworkConfig:
ipFamily: IPv6
vpc:
clusterEndpoints:
publicAccess: true
privateAccess: true
iam:
withOIDC: true
addons:
- name: vpc-cni
version: latest
- name: coredns
version: latest
- name: kube-proxy
version: latest
managedNodeGroups:
- name: x86-al2-on-demand-xl
amiFamily: AmazonLinux2
instanceTypes: [ "m6i.xlarge", "m6a.xlarge" ]
minSize: 1
desiredCapacity: 2
maxSize: 3
volumeSize: 100
volumeType: gp3
volumeEncrypted: true
labels:
os-distribution: amazon-linux-2
cluster-config.yaml
.1
eksctl create cluster -f cluster-config.yaml
aws sts get-caller-identity
in the terminal. Depending on how you configured the AWS CLI, you may also need to specify a named profile (for example, --profile clusteradmin
).1
2023-08-26 13:10:23 [✔] EKS cluster "ipv6-quickstart" in "us-east-2" region is ready
1
kubectl get pods -n kube-system -o wide
Running
or Completed
state, and there shouldn't be any pods in an Error
or CrashLoopBackOff
status. Also confirm that default Pods in the kube-system
namespace are assigned IPv6
addresses.1
2
3
4
5
6
7
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
aws-node-5cc8x 1/1 Running 0 41m 2600:1f16:1cc8:4002:bdb2:7cde:e292:5f19 ip-192-168-92-106.us-east-2.compute.internal <none> <none>
aws-node-rnc2g 1/1 Running 0 41m 2600:1f16:1cc8:4001:c4bd:a35b:9a08:6c6b ip-192-168-48-127.us-east-2.compute.internal <none> <none>
coredns-85dbc867bc-22qvz 1/1 Running 0 38m 2600:1f16:1cc8:4002:f92b::2 ip-192-168-92-106.us-east-2.compute.internal <none> <none>
coredns-85dbc867bc-x8dz5 1/1 Running 0 38m 2600:1f16:1cc8:4001:9b29:: ip-192-168-48-127.us-east-2.compute.internal <none> <none>
kube-proxy-9bntj 1/1 Running 0 38m 2600:1f16:1cc8:4001:c4bd:a35b:9a08:6c6b ip-192-168-48-127.us-east-2.compute.internal <none> <none>
kube-proxy-hv2d8 1/1 Running 0 38m 2600:1f16:1cc8:4002:bdb2:7cde:e292:5f19 ip-192-168-92-106.us-east-2.compute.internal <none> <none>
Ready
state with the following command. It’s also important to note that the nodes have been assigned an IPv6 internal address.1
kubectl get node -o wide
1
2
3
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
ip-192-168-26-20.us-east-2.compute.internal Ready <none> 50m v1.27.1-eks-2f008fe 2600:1f16:3bf:5f00:9bf1:c33c:16e7:d724 <none> Amazon Linux 2 5.10.184-175.731.amzn2.x86_64 containerd://1.6.19
ip-192-168-40-126.us-east-2.compute.internal Ready <none> 50m v1.27.1-eks-2f008fe 2600:1f16:3bf:5f01:202e:f3c1:dd02:c74 <none> Amazon Linux 2 5.10.184-175.731.amzn2.x86_64 containerd://1.6.19
IPv6
addresses.1
kubectl get services -n kube-system -o wide
1
2
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
kube-dns ClusterIP fdde:a64b:91a6::a <none> 53/UDP,53/TCP 51m k8s-app=kube-dns
eksctl-ipv6-quickstart-cluster/VPC
, which was created when the EKS cluster was initially set up.- Open the Amazon EC2 console.
- Under “Launch instance”, click the Launch instance button.Image not found
- Enter the following information to customize the instance:
- Type
ipv6-bastion
in Name. - Select
t2.micro
(ort3.micro
for newer regions if not available) for Instance type. - Keep the default selections for the other configuration settings for your instance, including the Amazon Linux AMI.
- Under Network, enter the following:
- Select Edit, and choose
eksctl-ipv6-quickstart-cluster/VPC
for VPC. - Keep the default selections for the other network settings, including the subnets and security group.Image not found
- Click Launch instance, and select Proceed without key pair, Proceed without key pair, then Launch instance.Image not found
- After your instance has launched, select your instance (e.g.,
i-0a001fe6790332b87
).Image not found - After selecting your instance, click the Connect button.Image not found
- On the Connect to instance page:
- Keep the default selections for the network settings, including “Connect using EC2 Instance Connect” and “User name.”
- Click Connect.Image not found
1
eksctl delete cluster -f ./cluster-config.yaml
1
2023-08-26 17:26:44 [✔] all cluster resources were deleted
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.