Difference between revisions of "Deploy EKS cluster using Terraform"

From wikieduonline
Jump to navigation Jump to search
Line 13: Line 13:
 
  [[Terraform EKS: terraform apply|terraform apply]]: [[Terraform EKS apply output]]
 
  [[Terraform EKS: terraform apply|terraform apply]]: [[Terraform EKS apply output]]
 
  It may take around 15 min
 
  It may take around 15 min
 
1.1) Review EKS cluster created
 
[[kubectl get nodes]]
 
The connection to the server localhost:[[8080]] was refused - did you specify the right host or port?
 
  
 
2) Update configuration
 
2) Update configuration
Line 22: Line 18:
 
  [[aws eks]] --region $(terraform output -raw region) [[update-kubeconfig]] --name $(terraform output -raw cluster_name)
 
  [[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]]
 
  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]]
 +
The connection to the server localhost:[[8080]] was refused - did you specify the right host or port?
  
 
3) Review [[resources]]:
 
3) Review [[resources]]:

Revision as of 20:21, 15 July 2022

Example

0) Download code

git clone https://github.com/hashicorp/learn-terraform-provision-eks-cluster
cd learn-terraform-provision-eks-cluster

1) Execute

terraform init #It may take several minutes
terraform plan
terraform apply: Terraform EKS apply output
It may take around 15 min

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
The connection to the server localhost:8080 was refused - did you specify the right host or port?

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

Related

eksctl create cluster

Activities

See also

Advertising: