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.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
where my-project is the ID of your Google Cloud project and my-cluster
is the cluster that you just created.
Set the gclouddefaults for your
Knative serving resources to the name of your new cluster and
its location. You set these defaults to avoid specifying these values each
time that you use the Google Cloud CLI.
Open the Create service form by clicking Create service.
In the available clusters dropdown menu, select the cluster you just
created.
Leave default entered as the name of the namespace.
Enter a service name, such as hello.
Click Next.
Select Deploy one revision from an existing container image, then
select hello from the demo containers drop-down.
Click Next.
Select External under Connectivity, so that you can invoke the
service.
Click Create to deploy the image to Knative serving
and wait for the deployment to finish.
Congratulations! You have just deployed a service to a
Knative serving enabled cluster.
Accessing your deployed service
Now that you have a service running, you can to send requests to it. In this
section, cURL is used to demonstrate how to access your service and verify
that it's working:
In the Google Cloud console, go to the Knative serving page.
Click the name of your new Knative serving service to go to its
Service details page.
Click infoinfo,
located to the right of the service's URL.
Click Invoke in Cloud Shell to run the generated cURL command
for your service in Cloud Shell.
The cURL request returns the source code of the sample container that your
service is running. Now you've verified that your service is handling requests!
Clean up
You can either disable Knative serving, or you can delete the
cluster and the Knative serving service to avoid incurring costs
for running these resources.
Disabling Knative serving
To disable Knative serving and keep your cluster:
In the Google Cloud console, go to the Google Kubernetes Engine page.
For an architectural overview of Knative serving that covers the
changes from installing Knative serving as an
add-on to your Google Kubernetes Engine cluster, see:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThis guide teaches how to deploy a prebuilt container to a Google Kubernetes Engine (GKE) cluster that has Knative serving enabled.\u003c/p\u003e\n"],["\u003cp\u003eYou will need to update or install the Google Cloud CLI, configure your project ID and zone, and enable the necessary APIs: Google Kubernetes Engine, Cloud Build, and Container Registry.\u003c/p\u003e\n"],["\u003cp\u003eA new GKE cluster with Knative serving can be created by using the Google Cloud CLI, specifying a cluster name, machine type, and number of nodes, and you must then set gcloud defaults to match.\u003c/p\u003e\n"],["\u003cp\u003eA sample container image can be deployed to the created cluster through the Knative serving page in the Google Cloud console by selecting your cluster, a namespace, a service name, and setting it to external connectivity.\u003c/p\u003e\n"],["\u003cp\u003eOnce deployed, the service can be accessed and verified via a cURL command generated in Cloud Shell, and can later be disabled or deleted entirely alongside its associated GKE cluster.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Deploy to Knative serving\n=====================================\n\nLearn to create a cluster enabled for Knative serving\nand then deploy a prebuilt sample container to that cluster.\n\nIf you have a demo account, you can instead follow this quickstart\n[on Google Cloud Skills Boost](https://www.cloudskillsboost.google/focuses/5147?parent=catalog).\n| **Note:** Knative serving is not supported on GKE clusters that have Windows Server node pools.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1. To ensure you have the latest version of the Google Cloud CLI, either install or update the Google Cloud CLI:\n - [Install and initialize the Google Cloud CLI.](/sdk/docs/install)\n - If you've already installed the gcloud CLI, update the installed components: \n\n ```bash\n gcloud components update\n ```\n\n### Setting up the command-line environment and enabling the required APIs\n\nComplete the following steps to set up your command-line environment for\nKnative serving and enable the required APIs:\n\n1. Configure the Google Cloud CLI to use the ID of your\n Google Cloud project by default:\n\n ```bash\n gcloud config set project PROJECT-ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT-ID\u003c/var\u003e with your project's ID.\n2. Set the [zone](/compute/docs/regions-zones#available) where you want the\n new cluster to be deployed. You can use any zone where\n GKE is supported. For example:\n\n ```bash\n gcloud config set compute/zone ZONE\n ```\n\n Replace \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e with your desired zone.\n3. Run the `gcloud services` command to enable the following APIs in your\n Google Cloud project:\n\n - Google Kubernetes Engine API: Create GKE clusters.\n - Cloud Build API: Build containers.\n - Container Registry API: Publish containers to Container Registry.\n\n ```bash\n gcloud services enable container.googleapis.com containerregistry.googleapis.com cloudbuild.googleapis.com\n ```\n\n This might take several seconds to complete. When the APIs have been enabled,\n the command line displays a message similar to the following: \n\n ```bash\n Operation \"operations/...\" finished successfully.\n ```\n\nCreating a GKE cluster with Knative serving enabled\n---------------------------------------------------\n\nComplete the following steps to create a cluster and enable it for\nKnative serving:\n\n1. Create a new cluster using the command:\n\n ```bash\n gcloud container clusters create CLUSTER_NAME \\\n --addons=HttpLoadBalancing,CloudRun \\\n --machine-type=e2-standard-4 \\\n --num-nodes=4 \\\n --enable-stackdriver-kubernetes\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e with the name you want for your cluster.\n2. Wait for the cluster creation to complete. During the creation process,\n you should see messages similar to the following:\n\n Creating cluster my-cluster...done.\n Created [https://container.googleapis.com/v1beta1/ \\\n projects/my-project/zones/us-central1-b/clusters/my-cluster].\n\n where `my-project` is the ID of your Google Cloud project and `my-cluster`\n is the cluster that you just created.\n3. Set the `gcloud` [defaults](/sdk/gcloud/reference/config#run) for your\n Knative serving resources to the name of your new cluster and\n its location. You set these defaults to avoid specifying these values each\n time that you use the Google Cloud CLI.\n\n ```bash\n gcloud config set run/platform gke\n gcloud config set run/cluster CLUSTER_NAME\n gcloud config set run/cluster_location ZONE\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e and \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e with the same values that\n you used to create your new cluster.\n\nDeploying a sample container\n----------------------------\n\nUse the Google Cloud console to deploy a sample container and create a service\nin your cluster:\n\n1. In the Google Cloud console, go to the **Knative serving page**.\n\n [Go to Knative serving](https://console.cloud.google.com/kubernetes/run)\n2. Open the **Create service** form by clicking **Create service**.\n\n3. In the available clusters dropdown menu, select the cluster you just\n created.\n\n4. Leave `default` entered as the name of the [namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/).\n\n5. Enter a service name, such as `hello`.\n\n6. Click **Next**.\n\n7. Select **Deploy one revision from an existing container image** , then\n select `hello` from the demo containers drop-down.\n\n8. Click **Next**.\n\n9. Select **External** under *Connectivity*, so that you can invoke the\n service.\n\n10. Click **Create** to deploy the image to Knative serving\n and wait for the deployment to finish.\n\nCongratulations! You have just deployed a service to a\nKnative serving enabled cluster.\n\nAccessing your deployed service\n-------------------------------\n\nNow that you have a service running, you can to send requests to it. In this\nsection, cURL is used to demonstrate how to access your service and verify\nthat it's working:\n\n1. In the Google Cloud console, go to the **Knative serving page**.\n\n [Go to Knative serving](https://console.cloud.google.com/kubernetes/run)\n2. Click the name of your new Knative serving service to go to its\n **Service details** page.\n\n3. Click **info** info,\n located to the right of the service's URL.\n\n4. Click **Invoke in Cloud Shell** to run the generated cURL command\n for your service in Cloud Shell.\n\nThe cURL request returns the source code of the sample container that your\nservice is running. Now you've verified that your service is handling requests!\n\nClean up\n--------\n\nYou can either disable Knative serving, or you can delete the\ncluster and the Knative serving service to avoid incurring costs\nfor running these resources.\n\n### Disabling Knative serving\n\nTo disable Knative serving and keep your cluster:\n\n1. In the Google Cloud console, go to the **Google Kubernetes Engine page**.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. Click the cluster where you want to disable Knative serving.\n\n3. Click **Edit**.\n\n4. Scroll down to *Anthos Features* and from the *Knative serving*\n dropdown, select **Disable**.\n\n5. Click **Save**.\n\n### Deleting Knative serving\n\nTo permanently delete your GKE cluster, including the\nKnative serving service and all its resources:\n\n1. In the Google Cloud console, go to the **Google Kubernetes Engine page**.\n\n [Go to Google Kubernetes Engine](https://console.cloud.google.com/kubernetes/list)\n2. Select the cluster you want to delete.\n\n3. Click **Delete** , the click **Delete** again on the pop up.\n\nWhat's next\n-----------\n\nTo learn how to build a container from code source, push to Container Registry,\nand then deploy, see:\n\n- [Building Containers](/anthos/run/archive/docs/building/containers)\n\nFor an architectural overview of Knative serving that covers the\nchanges from installing Knative serving as an\nadd-on to your Google Kubernetes Engine cluster, see:\n\n- [Architectural overview of Knative serving](/anthos/run/archive/docs/architecture-overview)"]]