2133 articles

how to update pod image in Kubernetes

Method 1: Edit Deployment

  1. Find the deployment you want to update:

    kubectl get deployments
  2. Edit the deployment with the updated image:

    kubectl edit deployment <deployment-name>
  3. In the YAML file, update the image field under the spec.template.spec.containers section with the new image. For example:

      - name: my-app
        image: my-app:latest
  4. Save and exit the YAML file.

More ~