<p>How do we update the <code>imagePullPolicy</code> alone for certain deployments using <code>kubectl</code>? The image tag has changed, however we don't require a restart. Need to update existing deployments with <code>--image-pull-policy</code> as <code>IfNotPresent</code></p>
<p>Note: Don't have the complete YAML or JSON for the deployments, hence need to do it via <code>kubectl</code></p>

Rayyan
<p>If you need to do this across several deployments, here is a code to help</p>
<pre><code>from kubernetes import client, config

# Load the Kubernetes configuration from default location
config.load_kube_config()

# Create a Kubernetes API client
api = client.AppsV1Api()

# Set the namespace to update deployments in
namespace = &quot;my-namespace&quot;

# Get a list of all deployments in the namespace
deployments = api.list_namespaced_deployment(namespace)

# Loop through each deployment and update its imagePullPolicy
for deployment in deployments.items:
    deployment.spec.template.spec.image_pull_policy = &quot;Always&quot;
    api.patch_namespaced_deployment(
        name=deployment.metadata.name,
        namespace=namespace,
        body=deployment
    )
</code></pre>
