Migrate a Service to Cloud Run
Move a service from Kubernetes or Compute Engine to Cloud Run. Cloud Run scales a service to zero when it has no traffic. The image does not change. See Architectural Overview for the reason this works.
Prerequisites
- A containerized service that runs on Kubernetes or Compute Engine. An
ApplicationorExternalApplicationmanifest defines it.
Support for Google Kubernetes Engine (GKE) is in active development and not yet generally available.
Steps
-
Open the manifest of the application.
-
Change
spec.targettoCLOUD_RUN.spec:
buildDefinition: user-reports-api-build
project: reporting-svc
target: CLOUD_RUN # was KUBERNETES -
Open a pull request. The plan shows the Kubernetes Deployment and Service as deleted and a Cloud Run service as created.
-
Merge the pull request.
Verify
The platform creates the Cloud Run service. It moves traffic to the new service and removes the old deployment. The app now costs nothing while idle. The fixed base around it keeps billing: the gateway in front of each public app, the network and any database.