Search code examples
google-cloud-platformgoogle-cloud-rungoogle-cloud-build

Specify startup probe option: gcloud beta run deploy


I have a cloud build pipeline which builds and tries to deploy a multi-container service on Cloud Run.

The containers are:

  • Frontend (exposed port 3000)
  • Backend

I specified in the cloudbuild.yaml that frontend depends on backend:

    args:
      - beta
      - run
      - deploy
      - $_SERVICE_NAME
      - >-
        --container=frontend
      - >-
        --image=$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME-frontend:$COMMIT_SHA
      - --port=3000
      - --depends-on=backend

However, this doesn't build because of error:

spec.template.spec.containers[0].depends_on: Dependent container 'backend' must have startup probe specified

And I don't see a way to specify the startup probe in the docs. https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy


Solution

  • You cannot use gcloud [beta] run deploy

    This may be (!?) because the complexity in the service configuration becomes somewhat overwhelming to define using CLI args|flags.

    You will need to define your service as a Knative Service and you can then use gcloud [beta] run services replace to deploy it.

    See Configuring probes

    In my experience, defined Cloud Run resources using the YAML configuration is probable the better way to go and more closely mirrors Kubernetes' model.