Search code examples
kubernetesgoogle-cloud-platformkubectl

How to redeploy google cloud platform using kubectl


I'm trying to find a quick command to redeploy a pod in Kubernetes.

  1. Currently, I pushed my docker image to google cloud.
  2. Then I list my pods
kubectl -n pringadi get pods
        NAME                                                        READY   STATUS      RESTARTS   AGE
        audit-server-757ffd5dd-ztn5s                                 1/1     Running     0          38m
        configs-service-75c98f68c7-q928q                            1/1     Running     0          36m       
  1. I edit the deployment config kubectl edit deployment audit-server.
  2. Update/change the image name.
  3. Save and exit.

Kubernetes immediately recognizes the change and redeploy audit-server.

Question: What if I pushed my docker image (a newer image) to google cloud with the same name (Step 4) and just want to redeploy the audit-server based on the current image. Is there a command for that? It a tedious job to keep editing the deployment config (Step 3)


Solution

  • It's wholly unclear what you're trying to do, but taking a guess:

    kubectl set image deploy audit-server "*=us.gcr.io/whatever/whateverelse:12345" will bump the image in your deployment without having to invoke your editor

    Alternatively, use something like skaffold or its competitors to continuously push and reload a Pod for development