Skip to content

Commit

Permalink
docs: multi-arch node groups example (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-ook authored Nov 22, 2020
1 parent b2a0827 commit 90b9b78
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 5 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Amazon EKS (Elastic Kubernetes Service)
[Amazon EKS](https://aws.amazon.com/eks/) is a fully managed Kubernetes service. Customers trust EKS to run their most sensitive and mission critical applications because of its security, reliability, and scalability.

## Assumptions
* You want to create an EKS cluster on AWS. This module will create an EKS control plane and data plane.
* This module will give you a utility bash script to configure kubernetes configuration file to access the EKS cluster.
* This module will create an EKS cluster on AWS. It will have a control plane and you can register multiple heterogeneous node groups as data plane.
* This module will give you a utility bash script to set up a kubernetes configuration file to access the EKS cluster.
* This module has several sub-modules to deploy kubernetes controllers and utilities using helm provider.

## Examples
- [Quickstart Example](https://github.com/Young-ook/terraform-aws-eks/blob/main/README.md#quickstart)
Expand Down Expand Up @@ -31,3 +31,15 @@ This terraform module will give you a shell script to get kubeconfig file of an

## IAM Role for Service Account
After then you will see the created EKS cluster and node groups and IAM role. For more information about configuration of service account mapping for IAM role in Kubernetes, please check out the [IAM Role for Service Accounts](https://github.com/Young-ook/terraform-aws-eks/blob/main/modules/iam-role-for-serviceaccount/README.md)

# Known Issues
## Unauthorized
You might get an error message when this module tries to create a `aws-auth` configuration map for a new EKS cluster. When prompted, reapply the terraform composition. Here is an example error message:
```
module.eks.kubernetes_config_map.aws-auth[0]: Creating...
Error: Unauthorized
on .terraform/modules/eks/main.tf line 341, in resource "kubernetes_config_map" "aws-auth":
341: resource "kubernetes_config_map" "aws-auth" {
```
99 changes: 99 additions & 0 deletions examples/arm64/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,105 @@ System Info:
Kube-Proxy Version: v1.17.11-eks-xxxxyy
```

## Application deployment for Hybrid-Architecture node groups
Amazon EKS customers can now run production workloads using Arm-based instances including the recently launched Amazon EC2 M6g, C6g, and R6g instances powered by AWS Graviton2 processors. [AWS Graviton](https://aws.amazon.com/ec2/graviton/) processors are custom built by Amazon Web Services using 64-bit ARM Neoverse cores to deliver the best price performance for you cloud workloads running on Amazon EC2.

The new general purpose (M6g), compute-optimized (C6g), and memory-optimized (R6g) instances deliver up to 40% better price/performance over comparable current generation x86-based instances for scale-out and Arm-based applications such as web servers, containerized microservices, caching fleets, and distributed data stores that are supported by the extensive Arm ecosystem. You can mix x86 and Arm based EC2 instances within a cluster, and easily evaluate Arm-based application in existing environments.

Create an EKS cluster with a mixed architecture based node groups. And run the command that you can see on the terraform output to get a kubeconfig file for cluster access. It should look like this: `bash -e .terraform/modules/eks/script/update-kubeconfig.sh -r us-west-2 -n eks-x86-arm64-tc2 -k kubeconfig`. For more detail of the script, please refer to the [Generate kubernetes config](https://github.com/Young-ook/terraform-aws-eks/blob/main/README.md#generate-kubernetes-config)

```
$ terraform apply -var-file tc2.tfvars
```
Edit and save a new deployment file (nginx.yaml) on your workspace and apply:
```
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
ports:
- port: 80
selector:
app: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
labels:
app: nginx
spec:
replicas: 30
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
```
```
$ kubectl apply -f nginx.yaml
service/my-nginx-svc created
deployment.apps/my-nginx created
```

To verify that the nginx pods are running properly on the multiple architecture node groups, run describe command.
```
$ kubectl describe nodes
Name: ip-172-xx-yx-xxx.us-west-2.compute.internal
beta.kubernetes.io/instance-type=m6g.medium
eks.amazonaws.com/nodegroup=eks-x86-arm64-tc2
kubernetes.io/arch=arm64
kubernetes.io/os=linux
CreationTimestamp: Fri, 20 Nov 2020 12:52:26 +0900
System Info:
Operating System: linux
Architecture: arm64
Container Runtime Version: docker://19.3.6
Kubelet Version: v1.17.12-eks-xxxxyy
Kube-Proxy Version: v1.17.12-eks-xxxxyy
Non-terminated Pods: (8 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE
--------- ---- ------------ ---------- --------------- ------------- ---
default my-nginx-xxxxyyyyww-bqpfk 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-fzpfb 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-kqht5 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-m5x25 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-tcv92 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
Events: <none>
Name: ip-172-xx-yy-xxx.us-west-2.compute.internal
beta.kubernetes.io/instance-type=m5.large
eks.amazonaws.com/nodegroup=eks-x86-arm64-tc2
kubernetes.io/arch=amd64
kubernetes.io/os=linux
CreationTimestamp: Fri, 20 Nov 2020 12:52:59 +0900
System Info:
Operating System: linux
Architecture: amd64
Container Runtime Version: docker://19.3.6
Kubelet Version: v1.17.12-eks-xxxxyy
Kube-Proxy Version: v1.17.12-eks-xxxxyy
Non-terminated Pods: (28 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE
--------- ---- ------------ ---------- --------------- ------------- ---
default my-nginx-xxxxyyyyww-5wlvd 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-626nn 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-6h7nk 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-dgppf 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
default my-nginx-xxxxyyyyww-fgp8r 0 (0%) 0 (0%) 0 (0%) 0 (0%) 3m2s
Events: <none>
```

## Clean up
Run terraform:
```
Expand Down
2 changes: 1 addition & 1 deletion examples/arm64/tc2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ node_groups = [
min_size = 1
max_size = 3
desired_size = 1
instance_type = "m5.large"
instance_type = "t3.small"
}
]
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ provider "kubernetes" {

resource "time_sleep" "wait" {
count = ((local.managed_node_groups_enabled || local.fargate_enabled) ? 0 : (local.node_groups_enabled ? 1 : 0))
create_duration = "300s"
create_duration = "180s"
depends_on = [
aws_eks_cluster.cp,
aws_eks_node_group.ng,
Expand Down

0 comments on commit 90b9b78

Please sign in to comment.