3

I'm using Cloud Run on Google Kubernetes Engine and I'm able to deploy and access services without a problem.

But since I'm running on GKE and paying for the cluster 24/7 it makes no sense to scale a deployment to zero and always have a cold start for the first request.

I've found that's it's possible to set minScale for the Knative autoscaler to disable scale to zero here, here and here, but I have no idea where to put it.

There are a lot of configurations, services and workloads inside GKE for Isito and Knative-Serving, but I couldn't find anything matching.

Which file or configuration do I have to edit to set minScale to 1? Or won't this be possible since Cloud Run manages the specific template internally?

Dustin Ingram
  • 20,502
  • 7
  • 59
  • 82
dbanck
  • 250
  • 2
  • 4

1 Answers1

2

Using kubectl, you should be able to set the annotation autoscaling.knative.dev/minScale: "1" on your Knative service.

See this page for more info

Steren
  • 7,311
  • 3
  • 31
  • 51
  • There is no Knative service, so I don't know here to set the annotation. That's what my question is about, sorry if I wasn't clear enough. – dbanck Apr 28 '19 at 15:06
  • 1
    What do you mean 'there is no Knative service'? When you deploy to Cloud Run on GKE, you create a Knative Service object. – Steren Apr 28 '19 at 16:27
  • Sorry, I might have misunterstood you. Can you explain what you mean by 'Knative Service object'? – dbanck Apr 28 '19 at 20:29
  • 1
    When you deploy to Cloud Run on GKE, you can use `kubectl` to inspect the created services: `kubectl list ksvc`. Using `kubectl apply`, you can set this annotation. – Steren Apr 29 '19 at 21:04
  • Thanks a lot! I was somehow looking for a generic Knative service for setting the `minScale` and not for individual services. I've now set `minScale` on each service and everything is working as expected. – dbanck Apr 30 '19 at 08:06