Skip to main content

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 Application or ExternalApplication manifest defines it.

Support for Google Kubernetes Engine (GKE) is in active development and not yet generally available.

Steps​

  1. Open the manifest of the application.

  2. Change spec.target to CLOUD_RUN.

    spec:
    buildDefinition: user-reports-api-build
    project: reporting-svc
    target: CLOUD_RUN # was KUBERNETES
  3. Open a pull request. The plan shows the Kubernetes Deployment and Service as deleted and a Cloud Run service as created.

  4. 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.

Next​