k8s开发基础-patch和replace的区别
patch是局部更新,增删改某一个属性,deployment回滚功能:replace是全局更新,对deployment的yaml文件进行整体修改的功能:
1.replace是全局更新,对deployment的yaml文件进行整体更新的功能:
2.patch是局部更新,增删改某一个属性,deployment回滚功能:
将想回滚的replicaset的spec.template 拷贝到 deployment的/spec/template :
template:
metadata:
creationTimestamp: null
labels:
app: web
pod-template-hash: 855f84555f
spec:
containers:
- image: nginx:1.9.1
imagePullPolicy: Always
name: nginx
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
并修改deployment的/metadata/annotations中deployment.kubernetes.io/revision属性的值为需要回滚replicaset对应的revision号。
底层就是这样实现!
更多推荐
所有评论(0)