Deploy an application to Cloud Run for Anthos (Knative serving)
Learn how to use the Google Cloud console to deploy a prebuilt sample container to run as a Cloud Run for Anthos (Knative serving) service.
Before you begin
You must have access to the Google Cloud project and cluster where Cloud Run for Anthos is installed. For details, see Cloud Run for Anthos fleet installation overview.
Tip: See the GKE Enterprise tutorial for details about the shortest path to setting up a GKE Enterprise environment that includes a GKE cluster and Anthos Service Mesh.
Deploying a sample container
Use the Google Cloud console to deploy a sample container and create a service in your cluster:
In the Google Cloud console, go to the Cloud Run for Anthos page.
Select the Google Cloud project in which your GKE cluster resides.
In the list of available clusters, click Login to connect.
Open the Create service form by clicking Create service.
In the available clusters dropdown menu, select your cluster.
Leave
default
as the name of the namespace where you want your service to run.Enter a service name of your choice. For example,
hello
.Click Next.
Select Deploy one revision from an existing container image, then select hello from in the Demo containers list.
Click Next.
Select External under Connectivity, so that you can access your service from the web.
Click Create to deploy the
hello
image to Cloud Run for Anthos and wait for the deployment to finish.
Congratulations! You have just deployed a service to a Cloud Run for Anthos enabled cluster.
Accessing your deployed service
Now that you have a service running, you can to send requests to it. In this section, the default test domain is used to demonstrate how to access your service and verify that it's working:
In the Google Cloud console, go to the Cloud Run for Anthos page.
Click the name of your new Cloud Run for Anthos service to open the Service details page. For example, hello.
At the top of the page, click the URL to access your deployed service through your web browser. For example, if you named your service
hello
, the URL is similar to the following but includes your cluster's external IP address:http://hello.default.kuberun.11.111.11.111.nip.io
Congratulations! Your Cloud Run for Anthos service is live and handling requests.
Clean up
You can delete the Cloud Run for Anthos service to avoid incurring costs from running those resources.
The following considerations apply to deleting a service:
- Deleting a service deletes all resources related to this service, including all revisions of this service whether they are serving traffic or not.
Deleting a service does not automatically remove container images from Container Registry. To delete container images used by the deleted revisions from Container Registry, refer to Deleting images.
Deleting a service with one or more Eventarc triggers does not automatically delete these triggers. To delete the triggers refer to Manage triggers.
After deletion, the service remains visible in the Google Cloud console and in the command line interface until the deletion is fully complete. However, you cannot update the service.
Deleting a service is permanent: there is no undo or restore. However, if after deleting a service, you deploy a new service with the same name in the same region, it will have the same endpoint URL.
To permanently delete the service and all its resources:
In the services list, locate the Cloud Run for Anthos service that you created and click its checkbox to select it.
Click DELETE.
What's next
To learn how to build a container from code source, push to Container Registry, and then deploy, see:
To learn more about how Cloud Run for Anthos works, see the Architectural overview.