在使用补丁机制的时候,要尽量保证每一个补丁只做一件事
原始 nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
workload.user.cattle.io/workloadselector: deployment-lizhe-nginx
name: nginx
namespace: lizhe
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
workload.user.cattle.io/workloadselector: deployment-lizhe-nginx
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
workload.user.cattle.io/workloadselector: deployment-lizhe-nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
resources: {}
stdin: true
tty: true
restartPolicy: Always
terminationGracePeriodSeconds: 30
kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- nginx.yaml
namePrefix: prod-
patchesStrategicMerge:
- increase_replicas.yaml
- set_memory.yaml
increase_replicas.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: lizhe
spec:
replicas: 10
set_memory.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: lizhe
spec:
template:
spec:
containers:
- name: my-nginx
resources:
limits:
memory: 512Mi