[Home-K8S] #22 FluxCD 계층과 분리 / 다중 클러스터 리소스 공유와 설정 분리
FluxCD - yaml 앞서 fluxcd 를 이용해서 helm chart 를 구성했습니다. 그 외에 일반적인 yaml
Terraform, Azure CLI 설치 및 연동
참고 : Azure Terraform 연동, RBAC 생성 오류 해결 방법
terraform 으로 설정한 인프라의 상태를 저장하는 파일.
terraform 과 tfstate에 대한 자세한 설명은 다른 글을 참고해 보자.
tfstate를 local에 저장하는 것이 리스크가 있고, 인프라에 대한 정보를 다른 협업자들과 공유하기 위해 Cloud에 저장한다.
(AWS S3와 다르게 Key를 이용하여 저장한다. )
Terraform 을 이용하여 생성할 수도 있지만, 어짜피 Terraform 으로 관리할 리소스가 아니므로 직접 생성한다.
공부를 위해 Terraform으로 생성해 보는 것도 추천한다.
# Resource Group 생성
az group create --name tfstate --location koreacentral
# Storage Account 생성
az storage account create --resource-group tfstate --name tfstate --sku Standard_LRS --encryption-services blob
# Container 생성
az storage container create --name tfstate --account-name tfstate
# KEY 환경 설정
ACCOUNT_KEY=$(az storage account keys list --resource-group tfstate --account-name tfstate --query '[0].value' -o tsv)
export ARM_ACCESS_KEY=$ACCOUNT_KEYterraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0.2"
}
}
backend "azurerm" {
resource_group_name = "tfstate"
storage_account_name = "tfstate"
container_name = "tfstate"
key ="terraform.tfstate"
}
}Key : Container에 저장할 tfstate의 이름
Comments