---
# System prepended metadata

title: Kustomize
tags: [k8s]

---

---
title: Kustomize
tags: k8s
---

# install

```
brew install kustomize
gcloud components install kustomize
```

# 目錄結構
```
├── base
│   ├── deployment.yaml
│   ├── kustomization.yaml
│   └── service.yaml
└── overlays
    ├── dev
    │   ├── deployment.yaml
    │   └── kustomization.yaml
    └── prod
        ├── deployment.yaml
        └── kustomization.yaml
```

# command
```
kustomize create
kustomize build
kustomize build | kubectl apply -f -
kubectl apply -k .
```

# kustomize
[範例文件](https://kubernetes.io/zh-cn/docs/tasks/manage-kubernetes-objects/kustomization/)

[API 文件](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/)

[基本用法](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/zh/README.md)

* base <已棄用>
* resources
* namespace
* images
* commonLabels
* commonAnnotations
* namePrefix
* nameSuffix
* configMapGenerator
* secretGenerator
* patchesStrategicMerge
