0

I have been manually deploying new pods with GKE for the past three years. Once done, I then configure Cloud Build for my CI/CD to deploy to GKE once the image is created, etc.

For the CD from CloudBuild, I use:

#   GKE run deploy
  - name: "gcr.io/cloud-builders/gke-deploy"
    args:
     ...

However, this year I keep getting an error with this process, because now GKE add a selector:

  selector:
    matchLabels:
      app: healthcheck
      app.kubernetes.io/managed-by: cloud-console <- this one
      environment: development

The conflict is that the CD cloud-builders/gke-deploy has its own selector. However, selectors are immutable, so my CD process cannot complete.

Because there are a few setups required and I prefer to do it manually, my current process involves saving the YAML generated by GKE, deleting the pod once the configuration, etc., has been set up, and then letting Cloud Build regenerate the pod after fetching the previously saved YAML.

But this is tedious. I am currently unable to find alternatives. I would love to hear about a different approach.

1 Answer 1

1

Using Google cloud console to create pods and deployments automatically adds labels and selectors that you don't define or control. The best alternative approach for you to try is switching your manual setup to kubectl. So instead, try to do the following:

  1. Create your deployment YAML manually or export the one from the GKE Console.

  2. Clean the YAML file by removing the app.kubernetes.io/managed-by: cloud-console label from both:

  • .spec.selector.matchLabels

  • .spec.template.metadata.labels

  1. Deploy it using kubectl.
Sign up to request clarification or add additional context in comments.

1 Comment

Ok thanks, I was afraid I had to do this manual step.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.