PitterPetter ํ๋ก์ ํธ์ GCP ๊ธฐ๋ฐ Kubernetes ์ธํ๋ผ์คํธ๋ญ์ฒ๋ฅผ Terraform์ผ๋ก ๊ด๋ฆฌํ๋ ์ ์ฅ์์
๋๋ค.
GitOps ๊ธฐ๋ฐ์ ํ๋์ ์ธ CI/CD ํ์ดํ๋ผ์ธ๊ณผ ๋ง์ดํฌ๋ก์๋น์ค ์ํคํ
์ฒ๋ฅผ ์ง์ํฉ๋๋ค.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PitterPetter Infrastructure โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ Internet โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ GCP Load Balancer โ โ
โ โ (34.64.212.163) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Nginx Ingress Controller โ โ
โ โ (ingress-nginx) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโ argocd.pitterpetter.com โโโบ ArgoCD (GitOps) โ
โ โโโ workflows.pitterpetter.com โบ Argo Workflows โ
โ โโโ rollouts.pitterpetter.com โบ Argo Rollouts โ
โ โโโ api.loventure.us โโโโโโบ Microservices โ
โ โโโ /api/auth โโโโโโโโโบ Auth Service โ
โ โโโ /api/course โโโโโโโบ Course Service โ
โ โโโ /api/diaries โโโโโโบ Content Service โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
PitterPetter_Infra/
โโโ ๐ Core Infrastructure
โ โโโ main.tf # ํต์ฌ ์ธํ๋ผ (VPC, ์๋ธ๋ท, GKE ํด๋ฌ์คํฐ)
โ โโโ gke.tf # GKE ๋
ธ๋ ํ ๋ฐ ํด๋ฌ์คํฐ ์ธ๋ถ ์ค์
โ โโโ networking.tf # ๋คํธ์ํฌ ๋ณด์ (๋ฐฉํ๋ฒฝ, NAT Gateway)
โ โโโ providers.tf # Terraform Provider ์ค์
โ
โโโ ๐ Ingress & SSL
โ โโโ ingress.tf # Nginx Ingress Controller + API ๋ผ์ฐํ
โ โโโ swagger_ingress.tf # Swagger UI Ingress ์ค์
โ โโโ ssl_files/ # SSL ์ธ์ฆ์ ํ์ผ๋ค
โ
โโโ ๐ GitOps & CI/CD
โ โโโ argocd.tf # ArgoCD (GitOps ๋ฐฐํฌ)
โ โโโ workflows.tf # Argo Workflows (์ํฌํ๋ก์ฐ ์ค์ผ์คํธ๋ ์ด์
)
โ โโโ rollouts.tf # Argo Rollouts (๊ณ ๊ธ ๋ฐฐํฌ ์ ๋ต)
โ
โโโ ๐ Monitoring & Observability
โ โโโ gmp.tf # Google Managed Prometheus ์ค์
โ โโโ gmp_dashboard.tf # GMP ๋์๋ณด๋ ๊ตฌ์ฑ
โ
โโโ โ๏ธ Configuration
โ โโโ variables.tf # ๋ชจ๋ ๋ณ์ ์ ์ (์ ๋ฆฌ๋จ)
โ โโโ outputs.tf # ์ถ๋ ฅ๊ฐ ์ ์ (ํฅ์๋จ)
โ โโโ backend.tf # Terraform State ๋ฐฑ์๋ ์ค์
โ
โโโ ๐ Environment Configs
โ โโโ env/
โ โ โโโ dev.tfvars # ๊ฐ๋ฐํ๊ฒฝ ์ค์ (4-8๋
ธ๋, e2-standard-2)
โ โ โโโ prod.tfvars # ์ด์ํ๊ฒฝ ์ค์ (4-8๋
ธ๋, e2-standard-2)
โ
โโโ ๐ ๏ธ Scripts & Tools
โ โโโ scripts/
โ โโโ cleanup.sh # ์ธํ๋ผ ์ ๋ฆฌ ์คํฌ๋ฆฝํธ
โ
โโโ ๐ Documentation
โ โโโ docs/
โ โ โโโ QUICKSTART.md # 5๋ถ ๋น ๋ฅธ ์์ ๊ฐ์ด๋
โ โ โโโ INGRESS_GUIDE.md # Ingress Controller ์์ธ ๊ฐ์ด๋
โ โ โโโ GMP_MONITORING_GUIDE.md # GMP ๋ชจ๋ํฐ๋ง ๊ฐ์ด๋
โ โโโ README.md # ์ด ํ์ผ
# 1. Terraform ์ค์น (v1.5+)
# macOS
brew install terraform
# Linux
wget https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip
unzip terraform_1.6.0_linux_amd64.zip
sudo mv terraform /usr/local/bin/
# 2. Google Cloud CLI ์ค์น
# macOS
brew install google-cloud-sdk
# Linux
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
# 3. kubectl ์ค์น
# macOS
brew install kubectl
# Linux
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# 4. Helm ์ค์น
# macOS
brew install helm
# Linux
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash# 1. GCP ํ๋ก์ ํธ ์์ฑ ๋ฐ ํ์ฑํ
gcloud projects create pitterpetter --name="PitterPetter"
gcloud config set project pitterpetter
# 2. ํ์ํ API ํ์ฑํ
gcloud services enable container.googleapis.com
gcloud services enable compute.googleapis.com
gcloud services enable storage.googleapis.com
gcloud services enable iam.googleapis.com
# 3. GCP ์ธ์ฆ
gcloud auth login
gcloud auth application-default login
# 4. ์๋น์ค ๊ณ์ ์์ฑ (์ ํ์ฌํญ)
gcloud iam service-accounts create terraform-sa \
--display-name="Terraform Service Account" \
--description="Service account for Terraform operations"git clone <https://github.com/PitterPetter/PitterPetter_Infra.gitl>
cd PitterPetter_Infraterraform init
terraform plan -var-file="env/dev.tfvars"
terraform apply -var-file="env/dev.tfvars"terraform init
terraform plan -var-file="env/prod.tfvars"
terraform apply -var-file="env/prod.tfvars"# ์ ์ฒด ์ธํ๋ผ ์์ฝ ์ ๋ณด
terraform output infrastructure_summary
# ๋น ๋ฅธ ์ ๊ทผ ๋ช
๋ น์ด๋ค
terraform output quick_access_commands
# ํน์ ์๋น์ค ์ ๋ณด
terraform output argocd_url
terraform output ssl_domain_name# GKE ํด๋ฌ์คํฐ ์ธ์ฆ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ
gcloud container clusters get-credentials pitterpetter-dev-cluster \
--region asia-northeast3 \
--project pitterpetter
# ํด๋ฌ์คํฐ ์ฐ๊ฒฐ ํ์ธ
kubectl get nodes
kubectl get namespaces# ํฌํธ ํฌ์๋ฉ
kubectl port-forward svc/argocd-server -n argocd 8080:443
# ์น ๋ธ๋ผ์ฐ์ ์์ ์ ์
# https://localhost:8080
# ์ฌ์ฉ์๋ช
: admin
# ๋น๋ฐ๋ฒํธ: dev-admin123! (๊ฐ๋ฐํ๊ฒฝ)# ํฌํธ ํฌ์๋ฉ
kubectl port-forward svc/argo-workflows-server -n argo 2746:2746
# ์น ๋ธ๋ผ์ฐ์ ์์ ์ ์
# https://localhost:2746# ํฌํธ ํฌ์๋ฉ
kubectl port-forward svc/argo-rollouts-dashboard -n argo-rollouts 3100:3100
# ์น ๋ธ๋ผ์ฐ์ ์์ ์ ์
# https://localhost:3100- Google Kubernetes Engine (GKE): ์ปจํ
์ด๋ ์ค์ผ์คํธ๋ ์ด์
- ํด๋ฌ์คํฐ:
pitterpetter-dev-cluster(asia-northeast3-b) - ๋
ธ๋ ํ:
pitterpetter-nodes(4๊ฐ ๋ ธ๋, e2-standard-2) - ์๋ ์ค์ผ์ผ๋ง: 4-8๊ฐ ๋ ธ๋
- ํด๋ฌ์คํฐ:
- Virtual Private Cloud (VPC): ๋คํธ์ํฌ ๊ฒฉ๋ฆฌ ๋ฐ ๋ณด์
- VPC:
pitterpetter-dev-vpc - ์๋ธ๋ท:
pitterpetter-dev-subnet(10.0.0.0/24)
- VPC:
- Cloud NAT: ์์๋ฐ์ด๋ ์ธํฐ๋ท ์ ๊ทผ
- Load Balancer: ๊ณ ์ IP (34.64.212.163)
- ArgoCD: GitOps ๊ธฐ๋ฐ ์ง์์ ๋ฐฐํฌ
- ๋ค์์คํ์ด์ค:
argocd - ์ ์:
https://34.64.212.163(Host:argo.loventure.us)
- ๋ค์์คํ์ด์ค:
- Argo Workflows: ์ํฌํ๋ก์ฐ ์ค์ผ์คํธ๋ ์ด์
- ๋ค์์คํ์ด์ค:
argo - ์ ์:
https://34.64.212.163(Host:workflows.loventure.us)
- ๋ค์์คํ์ด์ค:
- Argo Rollouts: ๊ณ ๊ธ ๋ฐฐํฌ ์ ๋ต (Blue-Green, Canary)
- ๋ค์์คํ์ด์ค:
argo-rollouts - ์ ์:
https://34.64.212.163(Host:rollouts.loventure.us)
- ๋ค์์คํ์ด์ค:
- Auth Service: ์ฌ์ฉ์ ์ธ์ฆ ๋ฐ ๊ด๋ฆฌ
- ์๋ํฌ์ธํธ:
https://api.loventure.us/api/auth/* - ํฌํธ: 8081
- ์๋ํฌ์ธํธ:
- Course Service: ์ฝ์ค ๊ด๋ฆฌ
- ์๋ํฌ์ธํธ:
https://api.loventure.us/api/course/* - ํฌํธ: 8083
- ์๋ํฌ์ธํธ:
- Content Service: ์ฝํ
์ธ ๊ด๋ฆฌ (์ผ๊ธฐ ๋ฑ)
- ์๋ํฌ์ธํธ:
https://api.loventure.us/api/diaries/* - ํฌํธ: 8082
- ์๋ํฌ์ธํธ:
- SSL/TLS: GCP SSL ์ธ์ฆ์ (
pitterpetter-ssl) - Nginx Ingress Controller: ํธ๋ํฝ ๋ผ์ฐํ ๋ฐ SSL ์ข ๋ฃ
- Cloud Logging: ์ค์ํ๋ ๋ก๊ทธ ๊ด๋ฆฌ
- Google Managed Prometheus (GMP): ์์ ๊ด๋ฆฌํ ๋ฉํธ๋ฆญ ์์ง
- PodMonitoring: 8๊ฐ ์๋น์ค ๋ฉํธ๋ฆญ ์์ง (์ ํ๋ฆฌ์ผ์ด์ + ELK)
- Alert Rules: 10๊ฐ ์๋ฆผ ๊ท์น (ํต์ฌ ์๋น์ค, ์ธํ๋ผ, ELK)
- ๋ฉํธ๋ฆญ ์์ง ๊ฐ๊ฒฉ: 30์ด
- ๊ณตํต ๋ผ๋ฒจ๋ง: cluster, environment, project, service, type
- Firewall Rules: ๋คํธ์ํฌ ๋ณด์ ์ ์ฑ
- PodMonitoring ๋ฆฌ์์ค: 5๊ฐ (์ ํ๋ฆฌ์ผ์ด์ ์๋น์ค)
- ๋์๋ณด๋: Google Cloud Monitoring (5๊ฐ ์์ ฏ)
- ๋ฉํธ๋ฆญ ์์ง: 30์ด ๊ฐ๊ฒฉ, HTTP ์คํค๋ง
- ๋์ ์๋น์ค: Gateway, Auth, Content, Course, AI
- CPU ์ฌ์ฉ๋ฅ :
kubernetes.io/container/cpu/core_usage_time - ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋ฅ :
kubernetes.io/container/memory/used_bytes - ๋คํธ์ํฌ ํธ๋ํฝ: ์์ /์ก์ ๋ฐ์ดํธ ์นด์ดํธ
- Container ์ฌ์์:
kubernetes.io/container/restart_count
๐ก ์์ธํ ์ค์ : GMP_MONITORING_GUIDE.md ์ฐธ์กฐ
# 1. ๋ณ๊ฒฝ์ฌํญ ๊ณํ ํ์ธ
terraform plan -var-file="env/dev.tfvars"
# 2. ๋ณ๊ฒฝ์ฌํญ ์ ์ฉ
terraform apply -var-file="env/dev.tfvars"
# 3. ์ํ ํ์ธ
terraform show
terraform output
# 4. ์ธํ๋ผ ์์ฝ ํ์ธ
terraform output infrastructure_summaryvariables.tf์ ๋ณ์ ์ ์ (๊ธฐ๋ณธ๊ฐ ์ ๊ฑฐ ๊ถ์ฅ)env/dev.tfvars์ ๊ฐ๋ฐํ๊ฒฝ ๊ฐ ์ค์ env/prod.tfvars์ ์ด์ํ๊ฒฝ ๊ฐ ์ค์ - ์ฝ๋์์ ๋ณ์ ์ฌ์ฉ
- ์ ์ ํ
.tfํ์ผ์ ๋ฆฌ์์ค ์ ์ outputs.tf์ ํ์ํ ์ถ๋ ฅ๊ฐ ์ถ๊ฐterraform plan์ผ๋ก ๊ณํ ํ์ธterraform apply๋ก ์ ์ฉ
- ํ๊ฒฝ๋ณ ์ค์ ๋ถ๋ฆฌ:
env/๋๋ ํ ๋ฆฌ๋ก ํ๊ฒฝ๋ณ ๋ณ์ ๊ด๋ฆฌ - ๋ณ์ ์ ๋ฆฌ: ์ฌ์ฉ๋์ง ์๋ ๋ณ์ ์ ๊ฑฐ ๋ฐ ์ต์ ํ
- Output ํฅ์: ์ธํ๋ผ ์์ฝ ์ ๋ณด ๋ฐ ๋น ๋ฅธ ์ ๊ทผ ๋ช ๋ น์ด ์ถ๊ฐ
- ๋ชจ๋ํฐ๋ง ๊ฐํ: GMP ๋์๋ณด๋ ๋ฐ ์์ธ ๋ชจ๋ํฐ๋ง ์ค์
- Swagger UI: API ๋ฌธ์ํ๋ฅผ ์ํ Swagger UI Ingress ์ถ๊ฐ
- ์ธํ๋ผ ์์ ์ฑ: GKE ํด๋ฌ์คํฐ ๋ฐ ๋คํธ์ํน ๊ตฌ์ฑ ์ต์ ํ
- ๋ณด์ ๊ฐํ: ๋ฐฉํ๋ฒฝ ๊ท์น ๋ฐ SSL ์ธ์ฆ์ ๊ด๋ฆฌ ๊ฐ์
variables.tf: ๋ถํ์ํ ๋ณ์ ์ ๊ฑฐ, ์ฝ๋ ์ ๋ฆฌoutputs.tf:infrastructure_summary,quick_access_commands์ถ๊ฐenv/: ํ๊ฒฝ๋ณ ์ค์ ํ์ผ ๋ถ๋ฆฌ (dev.tfvars, prod.tfvars)gmp_dashboard.tf: ๋ชจ๋ํฐ๋ง ๋์๋ณด๋ ์ถ๊ฐgke.tf: GKE ํด๋ฌ์คํฐ ์ค์ ์ต์ ํingress.tf: Ingress Controller ๋ฐ ๋ผ์ฐํ ๊ท์น ๊ฐ์networking.tf: ๋คํธ์ํฌ ๋ณด์ ์ ์ฑ ๊ฐํargocd.tf: ArgoCD ๋ฐฐํฌ ์ค์ ๊ฐ์
์ ์ ์ ๋ณด:
- URL:
https://34.64.212.163(Host:argo.loventure.us) - ์ฌ์ฉ์๋ช
:
admin - ๋น๋ฐ๋ฒํธ:
dev-admin123!
์ ์ ๋ฐฉ๋ฒ:
- ๋ธ๋ผ์ฐ์ ์ ์ (๊ถ์ฅ):
# ๋ธ๋ผ์ฐ์ ์์ https://34.64.212.163 ์ ์ # Host ํค๋๋ฅผ argo.loventure.us๋ก ์ค์ ํ๊ฑฐ๋ # curl๋ก ํ ์คํธ: curl -H "Host: argo.loventure.us" -k https://34.64.212.163
- ๋ณด์ ๊ฒฝ๊ณ ๊ฐ ๋ํ๋๋ฉด "๊ณ ๊ธ" โ "์์ ํ์ง ์์ ์ฌ์ดํธ๋ก ์ด๋" ํด๋ฆญ
์ ์ ์ ๋ณด:
- URL:
https://34.64.212.163(Host:workflows.loventure.us) - Port Forward:
kubectl port-forward svc/argo-workflows-server -n argo 2746:2746
์ ์ ์ ๋ณด:
- URL:
https://34.64.212.163(Host:rollouts.loventure.us) - Port Forward:
kubectl port-forward svc/argo-rollouts-dashboard -n argo-rollouts 3100:3100
๊ธฐ๋ณธ URL: https://api.loventure.us
์๋น์ค๋ณ ์๋ํฌ์ธํธ:
# Auth Service (์ฌ์ฉ์ ์ธ์ฆ)
curl -k https://api.loventure.us/api/auth/health
curl -k https://api.loventure.us/oauth2/authorize
# Course Service (์ฝ์ค ๊ด๋ฆฌ)
curl -k https://api.loventure.us/api/course/health
curl -k https://api.loventure.us/api/course/courses
# Content Service (์ผ๊ธฐ ๊ด๋ฆฌ)
curl -k https://api.loventure.us/api/diaries/health
curl -k https://api.loventure.us/api/diaries/diariesSwagger UI ์ ์:
- Auth Service:
https://swagger-auth.loventure.us - Content Service (Diaries):
https://swagger-diaries.loventure.us - Course Service:
https://swagger-courses.loventure.us
Swagger UI ์ํ ํ์ธ:
# ๋ชจ๋ Swagger Ingress ํ์ธ
kubectl get ingress -n loventure-app | grep swagger
# ํน์ Swagger UI ํ
์คํธ
curl -H "Host: swagger-auth.loventure.us" -k https://34.64.212.163# Ingress Controller ์ํ
kubectl get pods -n ingress-nginx
kubectl get svc -n ingress-nginx
# ๋ชจ๋ Ingress ํ์ธ
kubectl get ingress -A
# ์๋น์ค ์ํ ํ์ธ
kubectl get pods -n loventure-app
kubectl get svc -n loventure-appCloud Monitoring URL: https://console.cloud.google.com/monitoring
GMP ์ํ ํ์ธ:
# GMP Operator ์ํ
kubectl get pods -n gmp-system
# PodMonitoring ๋ฆฌ์์ค ํ์ธ
kubectl get podmonitorings -A
# ๋์๋ณด๋ ํ์ธ
# Google Cloud Console > Monitoring > Dashboards > "PitterPetter GMP Dashboard"
# ClusterPodMonitoring ํ์ธ
kubectl get clusterpodmonitorings๋ฉํธ๋ฆญ ์์ง ํ์ธ:
# ํน์ ์๋น์ค ๋ฉํธ๋ฆญ ํ์ธ
kubectl describe podmonitoring gateway-podmonitoring
# ์๋ฆผ ์ ์ฑ
ํ์ธ
kubectl describe rules <rule-name>Cloud Monitoring์์ ํ์ธํ ์ ์๋ ๋ฉํธ๋ฆญ:
- ์ ํ๋ฆฌ์ผ์ด์ ๋ฉํธ๋ฆญ: CPU, ๋ฉ๋ชจ๋ฆฌ, ์๋ต ์๊ฐ, ์์ฒญ ์
- ELK ์คํ ๋ฉํธ๋ฆญ: Elasticsearch ํด๋ฌ์คํฐ ์ํ, ๋ก๊ทธ ์ฒ๋ฆฌ๋
- ์ธํ๋ผ ๋ฉํธ๋ฆญ: ๋ ธ๋ ์ํ, ๋์คํฌ ์ฌ์ฉ๋, ๋คํธ์ํฌ ํธ๋ํฝ
# cleanup.sh ์คํฌ๋ฆฝํธ ์คํ
chmod +x scripts/cleanup.sh
./scripts/cleanup.sh# 1. Kubernetes ๋ฆฌ์์ค ์ ๋ฆฌ
kubectl delete namespace argocd --force --grace-period=0
kubectl delete namespace argo --force --grace-period=0
kubectl delete namespace argo-rollouts --force --grace-period=0
# 2. Terraform destroy
terraform destroy -var-file="env/dev.tfvars" -auto-approve# ๋ฌธ์ : Authentication error
# ํด๊ฒฐ: GCP ์ธ์ฆ ์ฌ์ค์
gcloud auth login
gcloud auth application-default login
gcloud config set project pitterpetter
# ์ถ๊ฐ ํ์ธ
gcloud auth list
gcloud config get-value project# ๋ฌธ์ : Provider not found
# ํด๊ฒฐ: Terraform ์ด๊ธฐํ
terraform init -upgrade
terraform providers
# ๋ฐฑ์๋ ๋ฌธ์ ์
terraform init -reconfigure# ๋ฌธ์ : Namespace stuck in Terminating state
# ํด๊ฒฐ: ๊ฐ์ ์ญ์
kubectl delete namespace argocd --force --grace-period=0
kubectl delete namespace argo --force --grace-period=0
kubectl delete namespace argo-rollouts --force --grace-period=0
kubectl delete namespace loventure-app --force --grace-period=0
# Finalizers ์ ๊ฑฐ (ํ์์)
kubectl patch namespace argocd -p '{"metadata":{"finalizers":null}}' --type=merge# ๋ฌธ์ : Cluster deletion timeout
# ํด๊ฒฐ: ์๋ ์ญ์
gcloud container clusters delete pitterpetter-dev-cluster \
--zone asia-northeast3-b \
--project=pitterpetter --quiet
# Terraform State์์ ์ ๊ฑฐ
terraform state rm google_container_cluster.primary# ๋ฌธ์ : State drift
# ํด๊ฒฐ: State ์๋ก๊ณ ์นจ
terraform refresh -var-file="env/dev.tfvars"
terraform plan -var-file="env/dev.tfvars"
# ํน์ ๋ฆฌ์์ค๋ง ์๋ก๊ณ ์นจ
terraform refresh -target=google_container_cluster.primary# ๋ฌธ์ : 404 Not Found ๋๋ ์ฐ๊ฒฐ ๋ถ๊ฐ
# ํด๊ฒฐ: Ingress Controller ์ํ ํ์ธ
kubectl get pods -n ingress-nginx
kubectl get svc -n ingress-nginx
kubectl describe pod -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx
# Ingress ๋ฆฌ์์ค ํ์ธ
kubectl get ingress -A
kubectl describe ingress -n argocd argocd-ingress# ๋ฌธ์ : ArgoCD ์น UI ์ ์ ์๋จ
# ํด๊ฒฐ: ArgoCD ์ํ ํ์ธ
kubectl get pods -n argocd
kubectl get svc -n argocd
kubectl logs -n argocd -l app.kubernetes.io/name=argocd-server
# ๋น๋ฐ๋ฒํธ ํ์ธ
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -d# ๋ฌธ์ : API ์๋ํฌ์ธํธ ์๋ต ์์
# ํด๊ฒฐ: ์๋น์ค ์ํ ํ์ธ
kubectl get pods -n loventure-app
kubectl get svc -n loventure-app
kubectl describe pod -n loventure-app -l app=auth-service
# ๋ก๊ทธ ํ์ธ
kubectl logs -n loventure-app -l app=auth-service --tail=100# ๋ฌธ์ : SSL ์ธ์ฆ์ ๊ด๋ จ ์ค๋ฅ
# ํด๊ฒฐ: ์ธ์ฆ์ ์ํ ํ์ธ
gcloud compute ssl-certificates list
kubectl get secrets -n argocd | grep tls
# Ingress TLS ์ค์ ํ์ธ
kubectl describe ingress -n argocd argocd-ingress# ๋ฌธ์ : Pod๊ฐ Pending ์ํ ๋๋ OOMKilled
# ํด๊ฒฐ: ๋ฆฌ์์ค ํ์ธ ๋ฐ ์กฐ์
kubectl top nodes
kubectl top pods -A
kubectl describe node
# ๋
ธ๋ ์ค์ผ์ผ๋ง
kubectl scale deployment --replicas=1 -n argocd argocd-server# Terraform ์ํ ํ์ธ
terraform show
terraform state list
terraform output
# GCP ๋ฆฌ์์ค ํ์ธ
gcloud compute instances list
gcloud container clusters list
gcloud compute networks list
# Kubernetes ๋ฆฌ์์ค ํ์ธ
kubectl get all --all-namespaces
kubectl describe nodes
kubectl logs -n argocd -l app.kubernetes.io/name=argocd๊ฐ๋ฐํ๊ฒฝ (dev.tfvars):
- ์ ์ ํ ์ธ์คํด์ค:
node_preemptible = true(์ต๋ 80% ๋น์ฉ ์ ์ฝ) - ๋จธ์ ํ์
:
e2-standard-2(2 vCPU, 8GB RAM) - ๋ ธ๋ ์: 4๊ฐ (์๋ ์ค์ผ์ผ๋ง: 4-8๊ฐ)
- ์์ ์ ๋น์ฉ: ~$50-80 (์ ์ ํ ์ธ์คํด์ค ์ฌ์ฉ ์)
์ด์ํ๊ฒฝ (prod.tfvars):
- ์ผ๋ฐ ์ธ์คํด์ค:
node_preemptible = false(์์ ์ฑ ์ฐ์ ) - ๋จธ์ ํ์
:
e2-standard-2(2 vCPU, 8GB RAM) - ๋ ธ๋ ์: 4๊ฐ (์๋ ์ค์ผ์ผ๋ง: 4-6๊ฐ)
- ์์ ์ ๋น์ฉ: ~$200-300
# GCP ๋น์ฉ ํ์ธ
gcloud billing budgets list --billing-account=YOUR_BILLING_ACCOUNT
# ๋ฆฌ์์ค ์ฌ์ฉ๋ ํ์ธ
gcloud compute instances list --filter="status:RUNNING"
gcloud container clusters list
# ํน์ ํ๋ก์ ํธ ๋น์ฉ ํ์ธ
gcloud billing accounts list
gcloud billing budgets list --billing-account=YOUR_BILLING_ACCOUNT_IDname: Deploy Infrastructure
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Setup GCP
uses: google-github-actions/setup-gcloud@v1
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Terraform Init
run: cd terraform && terraform init
- name: Terraform Plan
run: cd terraform && terraform plan -var-file="environments/dev.tfvars"
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
run: cd terraform && terraform apply -var-file="environments/dev.tfvars" -auto-approve- ๋น ๋ฅธ ์์ ๊ฐ์ด๋: ์๋ก์ด ํ์์ ์ํ 5๋ถ ์ค์ ๊ฐ์ด๋
- Ingress Controller ๊ฐ์ด๋: Nginx Ingress Controller ์์ธ ๊ฐ์ด๋