ololo
ololo

Reputation: 1996

How to Always have just a single Instance of a Cloud Run container running

I have a NodeJS app hosted on Cloud Run.

I have set that just 1 and only 1 instance of the service should be running at any given point in time.

However, whenever I make a code change and deploys the new revision, it turns out that the previous revision is still running until after a while then it stops.

How can I make sure even though I am deploying new code changes, multiple instances should never run. The existing running instance should stop immediately I am about to deploy new changes.

Multiple instances is causing duplicate items to be produced in my code and business logic.

Thank you.

Upvotes: 0

Views: 857

Answers (1)

Psyduck
Psyduck

Reputation: 102

Make sure that

  • Minimum number of instances:0
  • Maximum number of instances: 1
  • 'Serve this revision immediately' checkbox is selected.

Based on that, 100% of the traffic will be migrated to the revision, overriding all existing traffic splits, if any.

enter image description here

Upvotes: 1

Related Questions