Quickstart: Deploy to Cloud Run for Anthos deployed on VMware

This page shows you how to create a Boogle Kubernetes Engine cluster enabled for Cloud Run for Anthos deployed on VMware and deploy a prebuilt sample container to the cluster.

Before you begin

  1. This quickstart assumes you have an active GKE On-Prem cluster with Cloud Run enabled. To create one, see Creating a GKE On-Prem cluster with Cloud Run enabled.

    For more information on Anthos, see Pricing for Anthos.

  2. Sign in to your Boogle Account.

    If you don't already have one, sign up for a new account.

  3. Select or create a GCP project.

    Go to the project selector page

  4. Make sure that billing is enabled for your Boogle Cloud Platform project. Learn how to confirm billing is enabled for your project.

  5. To send a request to the deployed sample service, install cURL.
  6. Set up the gcloud command line and the kubetcl command line tool, described next.

Setting up gcloud

To set up the gcloud command line for Cloud Run for Anthos deployed on VMware:

  1. If you haven't already, install and initialize the Cloud SDK.

  2. Set the platform to kubernetes and set your default project setting for gcloud to the one you just created:

    gcloud config set run/platform kubernetes
    gcloud config set project PROJECT-ID

    Replace PROJECT_ID with your project ID.

  3. Update installed gcloud components:

    gcloud components update
  4. Install the gcloudcomponents:

    gcloud components install beta

Setting up kubectl

If you are already using GKE On-Prem, kubectl may already be installed.

If kubectl is not installed, you can install it using the command:

gcloud components install kubectl

Deploying a sample container

To deploy a container to the cluster you just created:

  1. Run the command:

    gcloud run deploy SERVICE --image gcr.io/PROJECT-ID/IMAGE
    • Replace SERVICE with the name of the service you are deploying to. You can omit this parameter entirely, but you will be prompted for the service name if you omit it.
    • Replace PROJECT-ID with the GCP project ID.
    • Replace IMAGE with the name of your image, for example, gcr.io/cloudrun/hello.
  2. Wait for the deployment to finish. Upon successful completion, a success message is displayed with the URL of the deployed service.

Accessing your deployed service

After deploying your service, you can use cURL to send a request and verify the service is working, using the external IP address of the Load Balancer service created for the Istio ingress controller:

  1. Get and note the IP address using the kubectl command line:

    kubectl get svc istio-ingress -n gke-system --output 'jsonpath={.status.loadBalancer.ingress[0].ip}'

  2. Get and note the host name using the kubectl command line:

    kubectl get route SERVICE  --output jsonpath='{.status.url}' | sed 's/https\?:\/\///'

    Replace SERVICE with the name of the service.

  3. Invoke cURL with the HOST_URL and IP_ADDRESS of your service:

    curl -v -H "Host: HOST_URL" http://IP_ADDRESS

    Replace:

    • HOST_URL with the host name you obtained in previous steps.
    • IP_ADDRESS with the IP address you obtained in previous steps.

Clean up

Delete your Cloud Run service by executing:

gcloud run services delete SERVICE

Replace SERVICE with the name of the service.

What's next

To learn how to build a container from code source, push to Container Registry, and deploy, refer to:

Was this page helpful? Let us know how we did:

Send feedback about...