Helm Chart 結構
Vibe Prompt
「幫我建立一個 Helm Chart 目錄結構,用於部署 Next.js 應用,包含 Deployment、Service、Ingress、HPA。」
目錄
my-chart/
├── Chart.yaml # 中繼資料
├── values.yaml # 預設值
├── templates/ # Go Template 檔案
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── hpa.yaml
│ └── _helpers.tpl # 共用函式
└── .helmignore # 忽略檔案
Chart.yaml
apiVersion: v2
name: my-app
version: 0.1.0
appVersion: "1.0.0"
description: A Helm chart for deploying my Next.js app
type: application
values.yaml
replicaCount: 2
image:
repository: ghcr.io/myorg/my-app
tag: latest
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
ingress:
enabled: true
host: myapp.com
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70
常用指令
helm create my-chart # 建立新 Chart
helm lint my-chart # 檢查語法
helm template my-chart # 渲染預覽
helm install release-name my-chart # 安裝
helm upgrade release-name my-chart # 升級
helm rollback release-name 1 # 回滾