For Knative serving on VMware, see the GA-level installation guide .
Support for the following GKE clusters are available as a Preview:
Use the steps on this page to configure a new installation or to update an existing fleet installation of Knative serving.
Before you begin
You must ensure that you meet the installation prerequisites .
Configure your CloudRun
custom resource
You need to manually create and configure the CloudRun
custom resource to
configure your installation.
CloudRun
custom resource for GKE clusters
outside Google Cloud: -
You must create or have an existing service account that has been granted the required Monitoring Metric Writer role (
monitoring.metricWriter).-
To create a new service account and then download the key, see Using service accounts .
-
If you have an existing service account with the necessary permissions, locate the key that you downloaded when you created that service account.
-
-
Ensure Cloud Monitoring is enabled in your GKE cluster:
-
Create the
knative-servingnamespace:kubectl create namespace knative-serving -
Create a secret in the
knative-servingnamespace that holds the service account withmonitoring.metricWriterpermissions:kubectl create secret -n knative-serving generic SECRET_NAME --from-file= PATH_TO_KEY_FILE / SECRET_KEYReplace:
- SECRET_NAME with the name that you choose for the secret.
- SECRET_KEY
with the name of the file that includes your
credentials. Example:
key.json - PATH_TO_KEY_FILE with the path to the directory of the SECRET_KEY .
See the
kubectl create secretreference to learn more, including optional flags. -
Create a YAML file with the following attributes, for example
cloudrunanthos.yaml:apiVersion : operator.run.cloud.google.com/v1alpha1 kind : CloudRun metadata : name : cloud-run spec : metricscollector : stackdriver : projectid : PROJECT_ID gcpzone : CLUSTER_LOCATION clustername : CLUSTER_NAME secretname : SECRET_NAME secretkey : SECRET_KEYReplace the following:
- PROJECT_ID with the ID of your Google Cloud project.
- CLUSTER_LOCATION with the region or zone in which your cluster is located.
- CLUSTER_NAME with the ID of your cluster or the fully qualified identifier for the cluster.
- SECRET_NAME
with the name of the Secret for the service account
of the
knative-servingnamespace. -
SECRET_KEY with the key of the Secret for the service account of the
knative-servingnamespace. For example:key.jsonFor details about service accounts, see:
In this example
CloudRuncustom resource, the configuration details for Cloud Monitoring are specified to use themy-gcp-logging-secretsecret andkey.jsonkey:apiVersion : operator.run.cloud.google.com/v1alpha1 kind : CloudRun metadata : name : cloud-run spec : metricscollector : stackdriver : projectid : my-gcp-project-id gcpzone : us-central1-c clustername : my-anthos-cluster-name secretname : my-gcp-logging-secret secretkey : key.json ```
Enable and install Knative serving
Enable the Knative serving component in your GKE Enterprise fleet
and then deploy your CloudRun
custom resource:
-
Enable Knative serving in your fleet:
gcloud container fleet cloudrun enable --project= PROJECT_IDReplace PROJECT_ID with the ID of your Google Cloud project.
For details and additional options, see the gcloud container fleet cloudrun enable reference.
-
Optional: Verify that the Knative serving feature component is enabled:
Console
View if the Knative serving component is Enabledin the Google Cloud console:
Command line
View if the
appdevexperiencestate isACTIVE:gcloud container fleet features list --project= PROJECT_IDReplace PROJECT_ID with the ID of your Google Cloud project.
For details and additional options, see the gcloud container fleet features list reference.
Result:
NAME STATE appdevexperience ACTIVE -
For each GKE Enterprise cluster where you want to install Knative serving, you must deploy your
CloudRuncustom resource:gcloud
gcloud container fleet cloudrun apply --kubeconfig = KUBECONFIG --context = CONTEXT --config = CONFIG_FILEReplace the following:
- KUBECONFIG with the absolute path to your kubectl config file.
- CONTEXT with the name of the context in your kubectl config file to use for connecting.
- CONFIG_FILE
with the filename relative path to your
cloudRuncustom resource. Examplecloudrunanthos.yaml.
For details and additional options, see the gcloud container fleet cloudrun apply reference.
kubectl
kubectl apply --kubeconfig = KUBECONFIG --filename CONFIG_FILEReplace the following:
- KUBECONFIG with the absolute path to your kubectl config file.
- CONFIG_FILE
with the filename and relative path to your
cloudRuncustom resource. Examplecloudrunanthos.yaml.
For details and additional options, see the kubectl apply reference.
- Verify that Knative serving has been enabled in your cluster:
- Open the Google Cloud console:
- Click on the name of your cluster to open the details pane.
- Run this command to check if you can see the Knative serving version details:
kubectl get all -n knative-serving -o 'go-template={{index .metadata.labels "serving.knative.dev/release"}}' - Verify that all Knative serving specific deployments are in running status under
knative-servingandappdevexperiencenamespaces.

