kustomize

kustomize

Tips

brew install kustomize

目录结构

# 应用基础目录
mkdir -p app/base app/overlays/{staging,production}
# kustomize build 生成 yaml
# 部署不同环境
kustomize build ~/ldap/overlays/staging | kubectl apply -f - --context staging
kustomize build ~/ldap/overlays/production | kubectl apply -f - --context production
# -k 可直接 apply
kubectl apply -k ~/ldap/overlays/staging --context staging
kubectl apply -k ~/ldap/overlays/production --context production
~/someApp - 基础应用目录
├── base - 基础层
│ ├── deployment.yaml
│ ├── kustomization.yaml
│ └── service.yaml
└── overlays - 叠加层
├── development - base+开发环境自定义内容
│ ├── cpu_count.yaml
│ ├── kustomization.yaml
│ └── replica_count.yaml
└── production - base+生产环境自定义内容
├── cpu_count.yaml
├── kustomization.yaml
└── replica_count.yaml