Before the creation, you need to decide with account to create cluster since K8S only grant system:masters for the creator account. Others account need to use RoleBinding
/ ClusterRoleBinding
for account creation. https://docs.aws.amazon.com/zh_tw/eks/latest/userguide/add-user-role.html
- Create an AWS role with
AmazonEKSClusterPolicy
(ROLE_A). This is used for EKS cluster creation. - Create an AWS role with
AmazonEKSWorkerNodePolicy
,AmazonEKS_CNI_Policy
,AmazonEC2ContainerRegistryReadOnly
(ROLE_B). This is used for work node group creation inside EKS cluster.
-
By manually
Create VPC with public subnet and put all node group inside public subnet.
-
By eksctl
Execute
eksctl/public-cluster.yml
(You need to create VPC with public subnet first). OR modify script to create VPC automatically.
-
By manually
You need to setup VPC Endpoint for 3 private subnets https://docs.aws.amazon.com/zh_tw/eks/latest/userguide/private-clusters.html
com.amazonaws.ap-southeast-1.s3
com.amazonaws.ap-southeast-1.ec2
com.amazonaws.ap-southeast-1.ecr.dkr
com.amazonaws.ap-southeast-1.ecr.api
com.amazonaws.ap-southeast-1.sts
-
By eksctl
Execute
eksctl/private-cluster.yml
(You need to create VPC with private subnet first). OR modify script to create VPC automatically.
-
By manually
Create public and private subnet with NAT gateway. Put worker node inside private subnet.
-
By eksctl
Execute
eksctl/public+private-cluster.yml
(You need to create VPC with NAT first). OR modify script to create VPC automatically.
- Create
kubeconfig
byaws eks update-kubeconfig --region ap-southeast-1 --name eks-demo
- Test config by
kubectl get svc
to get cluster information
- AWS credential and config stored in
~/.aws
kubeconfig
stored in~/.kube/config
- K8S service account: https://www.cnblogs.com/panwenbin-logs/p/10029834.html
- Install AWS load balancer controller for K8S https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html
- Refer to this link to see more structure
- Deploy deployment and service to K8S. The
k8s/nlb-service.yml
containservice.beta.kubernetes.io
will auto deploy NLB in AWS - Create VPN link for NLB
- Create API gateway connect to this VPN link
- Deploy deployment,
k8s/simple-service.yml
,k8s/alb-ingress.yml
. It will automatically create ALB for you.