Skip to content

nine-docs/terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Terraform ์‹คํ–‰

1. ๋กœ์ปฌ์— Terraform ์„ค์น˜

  • https://developer.hashicorp.com/terraform/install
    • ์—ฌ๊ธฐ์—์„œ Windows AMD 64 ๊บผ ๋‹ค์šด๋ฐ›์•„์„œ ์••์ถ• ํ’€๋ฉด ๋ฐ”์ด๋„ˆ๋ฆฌ ํŒŒ์ผ์ด ์žˆ์Œ
    • ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •ํ•ด์คฌ์Œ
  • ์„ค์น˜ ํ™•์ธ
    $ terraform -version
    Terraform v1.10.5
    on windows_amd64

2. Terraform ์ ์šฉ

2.1. terraform init

  • Terraform ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์—์„œ terraform init ๋ช…๋ น ์‹คํ–‰
    • ์ด ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด
      Terraform์ด AWS Provider ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ๋‹ค์šด๋กœ๋“œํ•œ๋‹ค.
  • ์‹คํ–‰ ํ™•์ธ
    $ ls -a
    ./   .terraform/          eks.tf      variables.tf
    ../  .terraform.lock.hcl  outputs.tf  vpc.tf
  • .terraform ๋“ฑ์ด ์ƒ์„ฑ๋œ ๊ฒƒ ํ™•์ธ

2.2. terraform plan

  • Terrform ํ”„๋กœ์ ํŠธ root ์—์„œ terraform plan ๋ช…๋ น ์‹คํ–‰

2.3. AWS์— ์ž์› ์ƒ์„ฑ

terraform apply -auto-approve

2.4. ์ƒ์„ฑ๋œ EKS ํด๋Ÿฌ์Šคํ„ฐ์™€ kubectl ์—ฐ๊ฒฐ

  • ๊ธฐ๋ณธ์ ์œผ๋กœ kubectl get nodes ๊ฐ™์€ ๋ช…๋ น์„ ์‹คํ–‰ํ•ด๋ณด๋ฉด ์‹คํ–‰์ด ๋˜์ง€ ์•Š์Œ.

  • ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๊ณ  ๋‹ค์‹œํ•ด๋ณด๋ฉด ์ž˜ ๋ ๊ฒƒ์ž„

    aws eks update-kubeconfig --region **ap-northeast-2** --name **ninedocs-eks-cluster**
    • ์ด ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ~/.kube/config ํŒŒ์ผ์ด EKS ํด๋Ÿฌ์Šคํ„ฐ์— ๋งž๊ฒŒ ์„ค์ •๋œ๋‹ค.
  • ์„ค์ • ํ™•์ธ

    kubectl config view
  • kubectl ํ™•์ธ

    $ kubectl get nodes
    NAME                                               STATUS   ROLES    AGE    VERSION
    ip-192-168-0-51.ap-northeast-2.compute.internal    Ready    <none>   9m1s   v1.31.4-eks-aeac579
    ip-192-168-1-249.ap-northeast-2.compute.internal   Ready    <none>   9m5s   v1.31.4-eks-aeac579
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages