项目作者: jpweber

项目描述 :
Terraform an EKS cluster
高级语言: HCL
项目地址: git://github.com/jpweber/eks-terraform.git
创建时间: 2018-06-26T18:29:24Z
项目社区:https://github.com/jpweber/eks-terraform

开源协议:

下载


Terraform EKS cluster

This project is a fork from the hashicorp example found here https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/eks-getting-started. Modified to build out more than an example cluster. This will create the following

  • VPC
  • Private Subnets
  • Public Subnets
  • Internet Gateway
  • NAT Gateway
  • Route tables
  • Route table associations
  • EKS Cluster
  • EKS Worker node scaling group
  • Bastion Host
  • EKS Control plane security groups
  • Worker node security groups
  • All required IAM policies

All variables in the variables.tf file can be overridden. An example vars file has been provided to work from.

Please reference the AWS documentation (https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html) If you have not created an eks cluster before. Import points that this terraform project doesn’t cover; installing heptio authenticator, or apply the config map for nodes to be able to authenticate with the cluster.

The output from terraform apply will provide you with a config map for AWS auth and a kubeconfig with all the required values populated.

  1. Outputs:
  2. config-map-aws-auth =
  3. apiVersion: v1
  4. kind: ConfigMap
  5. metadata:
  6. name: aws-auth
  7. namespace: kube-system
  8. data:
  9. mapRoles: |
  10. - rolearn: arn:aws:iam::000000000000000:role/terraform-eks-demo-node
  11. username: system:node:{{EC2PrivateDNSName}}
  12. groups:
  13. - system:bootstrappers
  14. - system:nodes
  15. kubeconfig =
  16. apiVersion: v1
  17. clusters:
  18. - cluster:
  19. server: https://94EF5DCC7DD400000000000000000.yl4.us-west-2.eks.amazonaws.com
  20. certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJ<snipped>HQjdub0FvMWNjSmRNajEzZTJlOXVZSzk4NkJhMmxJZDZqaz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
  21. name: kubernetes
  22. contexts:
  23. - context:
  24. cluster: kubernetes
  25. user: aws
  26. name: aws
  27. current-context: aws
  28. kind: Config
  29. preferences: {}
  30. users:
  31. - name: aws
  32. user:
  33. exec:
  34. apiVersion: client.authentication.k8s.io/v1alpha1
  35. command: heptio-authenticator-aws
  36. args:
  37. - "token"
  38. - "-i"
  39. - "terraform-eks-demo"