This demo shows how to use kubectl patch with json. A json patch can be applied to update tolerations of the deployment.
deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: patch-demo
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
name: patch-demo-ctr
image: nginx
tolerations:
effect: NoSchedule
key: dedicated
value: test-team
patch-tolerations.yml
op: replace
path: /spec/template/spec/tolerations/0
value:
effect: NoSchedule
key: disktype
value: ssd
patch command
kubectl patch deployment patch-demo --type json -p "$(cat patch-tolerations.yml)"