Blog maintanence in 2024
- kkumtree
2024-08-26T00:02:49+09:00
Before starting group study, I decided to update my blog.
Very small things, but I have some needs about it.
One is GitHub Actions’ dependency update and another is Licences.
Cause, Blog is deployed via Github Actions, I need to check dependencies in Github Actions’ workflow.
What I use is actions/checkout, actions/setup-go, and actions/setup-node.
| Name | Prev. Version | Latest Version | Purpose |
|---|---|---|---|
| checkout | actions/checkoutv3 | actions/checkoutv4 | Src. and Dest. Branch |
| setup-go | actions/setup-go@v4 | actions/setup-go@v5 | Hugo |
| setup-node | actions/setup-node@v3 | actions/setup-node@v4 | Vanila Framework |

κ·Έλ¦ΌμΌλ‘ λ°°μ°λ κ΅¬κΈ ν΄λΌμ°λ 101 리뷰
- kkumtree
2023-11-21T13:51:29+09:00
Jpubμμ μ΅κ·Ό μΆνν κ·Έλ¦ΌμΌλ‘ λ°°μ°λ κ΅¬κΈ ν΄λΌμ°λ 101 - μ μ΄ν ννμ΄μ§μ λν΄,
μ§§λ§νκ² μκ°νλ κΈμ
λλ€.
γκ·Έλ¦ΌμΌλ‘ λ°°μ°λ κ΅¬κΈ ν΄λΌμ°λ 101γ μνλ¨μΌλ‘ λ³Έ λμλ₯Ό μ 곡λ°μ μμ±νμμ΅λλ€.
μ΅κ·Ό AWS νλ‘μ νΈλ₯Ό μ§ννκ³ μμ΅λλ€. Terraformμ νμ©νμ¬, IaC κΈ°λ°μ μΈνλΌ κ΅¬μ±μ νκ³ μλλ°μ.
μλ
λΆν° DR(DR, Disaster Recovery)μ΄ κΈκ²©νκ² νλκ° λλ©΄μ,
Multi-AZ, Multi-Regionμ λμ΄ Multi-Cloudλ κ³ λ €μ λμμ΄ λλ κ² κ°μ΅λλ€.
κ΄μ¬μ΄ μλμ§λΌ μ΄λ² νλ‘μ νΈκ° λλλ©΄, AWS μΈμλ GCPκ°μ λ€μν CSPλ₯Ό λ€μκΈ λ€λ€λ³΄κ³ μΆλ€λ μκ°μ΄ λ€μμ΅λλ€.
λ¬Όλ‘ GCPλ₯Ό μ£Όλ ₯μΌλ‘ μ°κ³ μλ€λ©΄ μ΄μΌκΈ°κ° λ€λ₯΄κ² μ§λ§,
맨 μ²μ ν΄λΌμ°λλ₯Ό λ°°μ°λ μ
μ₯, νΉμ GCPμ λν κ΅¬μΆ κ²½νμ΄ μ μ μν©μμ μꡬμ¬νμ λ°λΌ μΆκ°μ μΌλ‘ GCPλ₯Ό ꡬμΆν΄μΌνλ μν©μ΄λΌλ©΄
κ΅λ΄μμλ κΈ°μ‘΄μ GCPλ₯Ό λΉ λ₯΄κ² μ κ·Όνκ³ λ°°μΈ μ μλ λ°©λ²μ΄ AWS λλΉ λ§μ§ μλ€κ³ λκΌμ΅λλ€.
TFC(Terraform Cloud) drift μλ¦Ό μ€μ
- kkumtree
2023-10-15T00:10:33+09:00
CloudNet@μμμ Terraform μ€ν°λκ° λλκ³ λμ,
ν
λΌνΌμ μ€μ μ΄μ μν©μ λμ
νλ©΄μ λ§μ£Όν μ λ°μ μλ λ리ννΈ(drift) μν©μ λν΄
μ΄ν΄ν΄λ³΄λ μκ°μ κ°μ‘μ΅λλ€.
μ°Έκ³ ) TFCμμμ Drift Detection κΈ°λ₯μ νμ¬ TFC Plus μλμ
μμ μ§μλ©λλ€.
1. μ©μ΄ μ΄ν΄ν΄λ³΄κΈ°
μ¬μ€μ μλ
λΆν° ν
λΌνΌμ μ νκ³ λμ, IaCλΌλ κ°λ
μ κ½νκΈ°λ§ νμ§
μ΄μ μ
μ₯μμ λ§μ£Όνμλ μλ§μ μνμ°©μ€λ€μ νν μ μ μλ¬λ‘λ§ μκ°ν΄μμμ΅λλ€.
μ€ν°λμ μ°Έμ¬νλ©΄μ μ’
μ’
‘λ리ννΈ’λΌλ λ¨μ΄λ₯Ό λ£κ³ , μ°Ύμ보λ
μλΉλΆλΆμ΄ μ΄μ μνλ μν©μ΄λΌλ κ²μ μ μ μμμ΅λλ€.
(1) Drift?
κΈ μμ±μ μν΄ μ°Ύμλ³Έ κΈ°μ μ Driftλ λ³Έλ μ£Όνμ μμ΄μμ κ·Έκ²κ³Ό
ν¬κ² μ°¨μ΄κ° μμμ μ μ μμμ΅λλ€.
Understanding terraform module
- kkumtree
2023-10-04T11:24:13+09:00
This week is last week of CloudNet@ group study about terraform.
In this study, my personal goal is making AWS architecture only with terraform and one tfstate file.
- Basic knowledge about AWS resources is required.
1. Terraform without Module
Before, I already met terraform for maintaining AWS in production level.
But at that time, our team maintain them as folder structure which is used by terraformer
# example structure
$ tree
.
βββ alb
β βββ lb.tf
β βββ lb_listener.tf
β βββ lb_target_group.tf
β βββ lb_target_group_attachment.tf
β βββ outputs.tf
β βββ provider.tf
β βββ variables.tf
βββ auto_scaling
β βββ autoscaling_group.tf
β βββ launch_template.tf
β βββ outputs.tf
β βββ provider.tf
β βββ variables.tf
βββ ec2_instance
β βββ instance.tf
β βββ outputs.tf
β βββ provider.tf
β βββ variables.tf
βββ eni
β βββ network_interface.tf
β βββ outputs.tf
β βββ provider.tf
βββ igw
β βββ internet_gateway.tf
β βββ outputs.tf
β βββ provider.tf
β βββ variables.tf
βββ nacl
β βββ default_network_acl.tf
β βββ outputs.tf
β βββ provider.tf
β βββ variables.tf
βββ route_table
β βββ main_route_table_association.tf
β βββ outputs.tf
β βββ provider.tf
β βββ route_table.tf
β βββ route_table_association.tf
β βββ variables.tf
βββ s3
β βββ outputs.tf
β βββ provider.tf
β βββ s3_bucket.tf
βββ sg
β βββ outputs.tf
β βββ provider.tf
β βββ security_group.tf
β βββ variables.tf
βββ subnet
β βββ outputs.tf
β βββ provider.tf
β βββ subnet.tf
β βββ variables.tf
βββ vpc
βββ outputs.tf
βββ provider.tf
βββ vpc.tf
At glance, this solution looks like cool.
But, problems were enough critical to think ‘why we have to use terraform?’.
Troubleshoot when using terraformer with tfenv
- kkumtree
2023-09-24T11:47:51+09:00
Removing & installing packages are some annoying, isn’t it? So, I like using version managers like SDKMAN, nvm, etc..
I also use tfenv for terraform version management.
(prev post: KR/‘Terraform μμνκΈ° w/Minimal Ubuntu’)
And I recommend neighbors to use terraformer for first learning about terraform.
terraformer is a great terraform generator tool for converting existing cloud infrastructure to terraform code.
In this post, I write how I use terraformer with tfenv.
1. How to install terraformer in Linux
- After follow below, you can use terraformer with
terraformercommand!
export PROVIDER=aws
# you can use other providers like 'google, kubernetes',
# Or if you want to use all providers, adjust 'all' instead of 'aws'
curl -LO "https://github.com/GoogleCloudPlatform/terraformer/releases/download/$(curl -s https://api.github.com/repos/GoogleCloudPlatform/terraformer/releases/latest | grep tag_name | cut -d '"' -f 4)/terraformer-${PROVIDER}-linux-amd64"
chmod +x terraformer-${PROVIDER}-linux-amd64
sudo mv terraformer-${PROVIDER}-linux-amd64 /usr/local/bin/terraformer
2. Importing AWS VPC with terraformer
- After install terraformer, you can import AWS VPC with terraformer like below
(Also you can import other AWS resources like EC2, S3, etc..)
terraformer import aws --resources=vpc --regions=ap-northeast-2
- But, error will happen… if you use tfenv like me.
$ terraformer import aws --resources=vpc --regions=ap-northeast-2
2023/09/24 12:03:53 aws importing region ap-northeast-2
2023/09/24 12:03:53 open /home/kkumtree/.terraform.d/plugins/linux_amd64: no such file or directory
$ whereis terraform
terraform: /home/kkumtree/.tfenv/bin/terraform
-
As you can see, terraformer can’t find terraform binary.
IAM STSλ₯Ό μ΄μ©ν Terraform Cloud κΆν λΆμ¬
- kkumtree
2023-09-13T20:54:28+09:00
μ΄λ²μλ Terraform Cloudκ° μΌλ§λ μ’μμ§ λ μμ보기 μν΄,
μ€ν°λμμ μ§μμ μΌλ‘ μ₯μ μ΄ κ°μ‘°λμ΄ μλ Terraform Cloudμ
IAM STSλ₯Ό μ΄μ©ν κΆν λΆμ¬ λμ λ° μ μ© μ±κ³΅μ λν΄ μ¨λ³΄λ €κ³ ν©λλ€.
Terraformμ μν μ μ₯μ μν΄ λ³΄ν΅ AWS S3λ₯Ό μ¬μ©νλλ°,
μλ€μνΌ S3 κΈ°λ‘μ 무λ£μ§λ§, λΆλ¬μ€λ κ²μ μ λ£μ
λλ€.
(μ κΈ°λ κ΅μ°μ΄μ§λ§, μλ£λ μμ
μ
λλ€)
κ·Έλμ μ€ν°λμ©μΌλ‘λ Terraformμ λΆλ¬μ¬ λλ§λ€,
μν κ°μ S3λ§κ³ , λ‘컬μ μ μ₯νμλλ°μ.
λ°μμλ λ
ΈνΈλΆ, μ§μμλ λ°μ€ν¬νμΌλ‘ νλ €λ
μ΄κ±Έ GitHubμ Private Repoμ μ μ₯ν κΉ? νλ€κ°
Terraform Cloudλ₯Ό μ¨λ³΄κΈ°λ‘ νμ΅λλ€. (κ³ ν΅μ μμ)
Terraform resource μ΄ν΄νκΈ° w/AWS VPC
- kkumtree
2023-09-08T22:41:14+09:00
μ΄λ²μλ CloudNet@λ₯Ό ν΅ν΄ νμ΅ν λ΄μ©μ κΈ°λ°μΌλ‘,
- AZλ₯Ό λμμΌλ‘ ν data μ‘°ν
- AWS VPC μμ± μμ λ‘ μ΄ν΄λ³΄λ output
- resource μ΄λ¦ λ³κ²½
μμΌλ‘ μμ보λλ‘ νκ² μ΅λλ€.
κ΅μ¬λ‘ μ¬μ©ν [ν λΌνΌμΌλ‘ μμνλ IaC] λ μ°Έκ³ νμμ΅λλ€.
κΈ°λ³Έ μ€μ
- aws-cliμ 리μ μ
ap-northeast-2μ μ€μ νμμ΅λλ€.
$ aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************2U5J shared-credentials-file
secret_key ****************Z0co shared-credentials-file
region ap-northeast-2 config-file ~/.aws/config
1. data μ‘°ν
dataλ μ¬μ©μκ° μ μνλ resource λ° λ¦¬μμ€μ λν μ€νκ³Ό λ°λλ‘,
provider(μ΄λ² ν¬μ€νΈμμλ aws)μμ μ 곡νλ 리μμ€λ₯Ό μ‘°ννλ κΈ°λ₯μ
λλ€.
Terraform μμνκΈ° w/Minimal Ubuntu
- kkumtree
2023-08-31T22:21:08+09:00
μ΄λ²μλ CloudNet@μμ μ§ννλ Terraform μ€ν°λ(μ΄ν, T101)μ μ°Έμ¬νμ΅λλ€.
Terraformμ μ°λ©΄ μ μ’μμ§λ μμΈνκ³ μ λ¬Έμ μΈ κΈμ΄ μμΌλ―λ‘, μ°Έκ³ νμλ©΄ μ’μ κ² κ°μ΅λλ€. (λ§ν¬: 44bits)
μμ μ ν
λΌνΌμ μΌλ μ μ΄ μμ§λ§, Moduleνκ° μ΄λ ΅κΈ°λ νκ³
μ΄λ² κΈ°νμ ν
λΌνΌ μ κ°μ λ€μ 볡기νλ λ§μμΌλ‘ μ°Έμ¬νμ΅λλ€.
μ¬μ©ν κ΅μ¬λ [ν λΌνΌμΌλ‘ μμνλ IaC] μ λλ€.
μ΄λ²μλ Terraform μ΄κΈ° μ
μ
μ λν΄, μ΄ν΄λ³΄κ³
μνμΌμ Canonical 곡μ Minimal Ubuntu(ARM64) AMIλ₯Ό μ€μΉν΄λ³΄κ² μ΅λλ€.
- Terraform μ€μΉ
- tfenv μ¬μ©κ³Ό .tf μμ± λ°λΌνκΈ°
- Hello World in terraform
- Terraform μ¨λ³΄κΈ°
μμΌλ‘ μ§νν©λλ€.
Terraform μ€μΉ
Terraformμ Linux νκ²½(Ubuntu κΈ°μ€)μμ μ€μΉν μ μλ λ°©λ²μ΄ 3κ°μ§ μ λ μμ΅λλ€.
μ΅μ λ΄μ©μ Terraform CLIμμ νμΈν μ μμ΅λλ€.
Init Calico from quay registry
- kkumtree
2023-07-25T00:40:14+09:00
Error I met
I met error message like Init:ImagePullBackOff when I tried to create calico pod.
kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-xxxxxxxxxx-yyyyy 1/1 Running 1 13h
kube-system calico-node-xxxxx 0/1 Init:ImagePullBackOff 0 13h
Why it happened
Yes, it’s because of changed docker hub policy. Recently, I’m in an environment that about 20~30 people use 4 public IP addresses. So, it’s easy to reach docker hub pull rate limit.
Windowsμμ μ¬λ¬ Github ν ν° κ΄λ¦¬
- kkumtree
2023-07-04T09:57:14+09:00
νμμλ Gitκ΄λ¦¬λ₯Ό terminalμ ν΅ν΄μ νκ³ ,
μ¬λ¬ SSHν€λ₯Ό ν΅ν΄ μμ
μ νκΈ°μ
.ssh/configλ₯Ό ν΅ν΄ ν€ κΈ°λ°μΌλ‘ κ΄λ¦¬νκ³ μμλ€.
μ΄μ©λ€λ³΄λ, ν ν° κΈ°λ°μΌλ‘ κ·Έκ²λ μλμ°μμ κ΄λ¦¬λ₯Ό ν΄λ³΄κ² λμ΄μ
λ λ€ μμν μ κ·Όμ΄λΌ μλ‘μ΄ μ
μ
μ μ μ©ν΄λ³΄κΈ°λ‘ νλ€.
VSCode κΈ°λ°μΌλ‘ μΈν
νκΈ°μ,
κ·Έλλ‘ λ°λΌμ¨λ€λ©΄ λ³ λ¬Έμ μμ΄ μ μ μ©λ κ²μ΄λ€.
cf. classic tokenμ΄λΌ ν μ§λΌλ, ν° μ΄μλ μμ κ²μΌλ‘ μκ°λλ€.
Git configμ μ μ©λ²μ
git config <parameter>λ₯Ό ν΅ν΄, μ€μ κ°μ ꡬμ±ν μ μλ€.
system > global > local μμΌλ‘ μ΅μ
μ΄ overrideλλ€.