How to make same change across yaml file of all the deployments present in a namespace

9/30/2019

I want to make same change in the yaml file for every deployment , Is there any way to make the change across all deployments present in a namespace in batch rather than one deployment at a time ?. I am currently using this syntax to edit yaml file of one deployment at a time -

kubectl edit deployment.v1.apps/nginx-deployment
-- Adarsh kashyap
kubernetes
kubernetes-helm
kubernetes-pod

1 Answer

9/30/2019
kubectl get deployment -o name | sed -e 's/.*\///g' | xargs -I {} kubectl patch deployment {} --type=json -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Always"}]'
-- MangeshBiradar
Source: StackOverflow