Quickstart: Deploy to Knative serving on VMware

Learn how to enable Knative serving on Google Distributed Cloud and deploy a prebuilt sample container to the cluster.

Before you begin

  1. This quickstart assumes you have active Google Distributed Cloud with Knative serving enabled. To create one, see Setting up Knative serving on VMware.

    For information about GKE Enterprise, see GKE Enterprise Pricing.

  2. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  3. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  4. Make sure that billing is enabled for your Google Cloud project.

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. To send a request to the deployed sample service, install cURL.
  8. To ensure you have the latest version of the Google Cloud CLI, either install or update the Google Cloud CLI:

Setting up the command-line environment

Set up the gcloud CLI and kubectl for Knative serving on VMware:

  1. Install and initialize the Google Cloud CLI.

  2. Set the default Google Cloud project that is used by the Google Cloud CLI to the Google Cloud project that you just created:

    gcloud config set project PROJECT-ID

    Replace PROJECT_ID with the ID of your Google Cloud project.

  3. Install the kubectl command-line tool:

    gcloud components install kubectl
  4. Update installed gcloud CLI components:

    gcloud components update

Deploying a sample container

To deploy a container to the cluster you just created:

  1. Run the command:

    gcloud run deploy SERVICE --image IMAGE_URL
    • 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 IMAGE_URL with a reference to the container image, for example, gcr.io/myproject/my-image:latest.
  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 domain 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 DOMAIN and IP_ADDRESS of your service:

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

    Replace:

    • DOMAIN with the domain that you previously obtained.
    • IP_ADDRESS with the IP address you obtained in previous steps.

Clean up

Delete your Knative serving on VMware 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: