Reference URL:
Kustomize - Kubernetes native configuration management
what is kustomize
A Kubernetes-integrated configuration management tool. Lightweight version of helm;
In the future, some middleware deployed by our company can encapsulate the file structure managed by kustomize
Only need kubectl apply -k to quickly deploy applications in different environments
# 除了使用 kubectl apply -k 可以用以下方式运行
kustomize build common/istio-1-11/istio-install/base | kubectl apply -f -
Demo usage
customization.yaml
commonLabels:
app: hello # 构建出来的每个资源上都有app=hello标签
resources: # 要部署哪些资源
- deployment.yaml
- service.yaml
- configMap.yaml
run
kubectl apply -k demo
Advanced usage
When we have a large number of microservices or a large number of environments, we have many sets of configurations. These configurations are only slightly different, but to a large extent the same. Kustomize can inherit templates and then personalize the coverage templates Generate the description files required for the final deployment of the application.
Many times we have differences in deployment for different environments. We can define deployments for different environments by creating a new overlays folder on the basis of "demo usage" . We define a production environment and a demo environment as follows:
As for what content can be written in the kustomization file, please refer to: Configuration Management | SIG CLI