标签:div style 技术 code touch 参考 data- block pps
kustomize 是一个可以方便我们基于模版配置,自定义kubernetes 的工具,类似kompose,但是个人觉得kompose
更灵活点,而且使用上更方便
mac
brew install kustomize
touch kustomization.yaml
内容如下:
commonLabels:
app: hello
resources:
- deployment.yaml
- configMap.yaml
- service.yaml
如下:
deploy:
apiVersion: apps/v1
kind: Deployment
metadata:
name: appdmeo
spec:
selector:
matchLabels:
app: appdmeo
template:
metadata:
labels:
app: appdmeo
spec:
containers:
- name: appdmeo
image: nginx
ports:
- containerPort: 80
service:
kind: Service
apiVersion: v1
metadata:
name: appdemo
spec:
selector:
app: appdmeo
type: NodePort
ports:
- name: http
port: 80
targetPort: 80
configmap:
apiVersion: v1
kind: ConfigMap
metadata:
name: myconfigmap
labels:
app: myapplication
data:
username: dalongdemo
kustomize build
生成的内容
apiVersion: v1
data:
username: dalongdemo
kind: ConfigMap
metadata:
labels:
app: hello
name: myconfigmap
---
apiVersion: v1
kind: Service
metadata:
labels:
app: hello
name: appdemo
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app: hello
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hello
name: appdmeo
spec:
selector:
matchLabels:
app: hello
template:
metadata:
labels:
app: hello
spec:
containers:
- image: nginx
name: appdmeo
ports:
- containerPort: 80
https://kubernetes.io/blog/2018/05/29/introducing-kustomize-template-free-configuration-customization-for-kubernetes/
https://kustomize.io/
https://github.com/kubernetes-sigs/kustomize
https://www.jianshu.com/p/65490ab651e1?utm_campaign=hugo
kustomize 模版自由的配置&&自定义kubernetes工具
标签:div style 技术 code touch 参考 data- block pps
原文地址:https://www.cnblogs.com/rongfengliang/p/10025375.html