Difference between revisions of "Deploy EKS cluster using Terraform"
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
* Change [[TFC execution mode]] to [[local]] in TFC web portal | * Change [[TFC execution mode]] to [[local]] in TFC web portal | ||
* Change [[name]] in [[main.tf]] ([[Terraform module: vpc]] section) to your prefered VPC name | * Change [[name]] in [[main.tf]] ([[Terraform module: vpc]] section) to your prefered VPC name | ||
− | * Configure your [[AWS profile]] name in [[main.tf]], do not use default. | + | * Configure your [[AWS profile]] name in <code>[[main.tf]]</code>, do not use default. |
[[export]] [[TF_CLOUD_ORGANIZATION]]=test | [[export]] [[TF_CLOUD_ORGANIZATION]]=test |
Revision as of 21:34, 11 February 2024
- Terraform EKS module:
Contents
Example
0) Download code
git clone https://github.com/hashicorp/learn-terraform-provision-eks-cluster && cd learn-terraform-provision-eks-cluster
1) Execute (tf login
)
- Change TFC execution mode to local in TFC web portal
- Change name in main.tf (Terraform module: vpc section) to your prefered VPC name
- Configure your AWS profile name in
main.tf
, do not use default.
export TF_CLOUD_ORGANIZATION=test
terraform init #It may take several minutes terraform plan terraform apply: Terraform EKS apply output It may take around 15 min
one liner: export TF_CLOUD_ORGANIZATION=test && tf init && tf plan && tf apply
2) Update configuration
Update kubeconfig with credentials: aws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name) Added new context arn:aws:eks:us-east-2:XXXXXXX:cluster/myeks-eks-xxxx to /Users/youruser/.kube/config
2.1) Review EKS cluster created
kubectl get nodes NAME STATUS ROLES AGE VERSION ip-10-0-1-29.us-east-2.compute.internal Ready <none> 5m31s v1.23.9-eks-ba74326 ip-10-0-1-47.us-east-2.compute.internal Ready <none> 5m21s v1.23.9-eks-ba74326 ip-10-0-2-121.us-east-2.compute.internal Ready <none> 5m13s v1.23.9-eks-ba74326
3) Review resources:
terraform show | grep -w resource | sort | uniq
4) Configure kubectl
aws eks list-clusters --output text | awk '{print $2}' aws eks update-kubeconfig --name my-eks-cluster-name
5) Review cluster status/configuration
kubectl cluster-info kubectl get all -A Default EKS installation
6) Install your desired addons:
helm install
Errors
Error: Failed to read organization
Error: failed to create backend alias to target "". The hostname is not in the correct format.
Error: Invalid or missing required argument .../... TF_CLOUD_ORGANIZATION
Related
helm install
aws eks update-kubeconfig --name my-eks-cluster-name
kubectl cluster-info
kubectl get nodes
,kubectl describe nodes
kubeclt get services
Terraform resource: aws eks cluster
AccessDenied ... CreateRole
iam:CreatePolicy
,iam:CreateRole
aws eks create-cluster
asg_desired_capacity
,InstanceType
- Terraform eks managed node groups: instance types
- K8s installation:
eksctl create cluster
- Deploy GKE cluster using Terraform
eks-cluster.tf
https://github.com/hashicorp/learn-terraform-provision-eks-cluster/blob/main/eks-cluster.tfworker_groups
node_groups
- terraform.tf
Activities
- Review https://learn.hashicorp.com/tutorials/terraform/eks
- Create your first EKS Cluster using AWS Management Console
See also
- Terraform EKS module:
manage_aws_auth_configmap, create_aws_auth_configmap, aws_auth_roles, aws_auth_users, aws_auth_accounts, module.eks, Amazon EKS Blueprints for Terraform, OIDC
- Terraform EKS, Terraform EKS module, Deploy EKS cluster using Terraform, Terraform EKS apply output,
terraform show, ~/.kube/config
,aws_eks_cluster, aws_eks_addon, module.eks_managed_node_group, eks-cluster.tf, node_groups, worker_groups
Advertising: