Configure the command-line tools to connect to and interact with Knative serving.

<br />

These steps assume you are using a Mac or Linux operating system. If you are using Microsoft Windows, you need to adjust the commands.

<br />

Although you can choose to use the
[Google Cloud console](https://docs.cloud.google.com/kubernetes-engine/enterprise/knative-serving/docs/console.md.txt) to manage
Knative serving, there are some tasks that require the command-line
tools.

To install and configure the command-line tools for Knative serving:

1. [Install and initialize the Google Cloud CLI](https://docs.cloud.google.com/sdk/docs/install).

2. Configure the Google Cloud CLI [defaults](https://docs.cloud.google.com/sdk/gcloud/reference/config.md.txt#run):

   1. Set your default Google Cloud project:

      ```bash
      gcloud config set project PROJECT_ID
      ```

      Replace <var translate="no">PROJECT_ID</var> with the ID of your Google Cloud project.
   2. Set the
      [target platform](https://docs.cloud.google.com/sdk/gcloud/reference/run/deploy.md.txt#--platform):

      ```bash
      gcloud config set run/platform gke
      ```
   3. Set the location of your cluster:

      ```bash
      gcloud config set run/cluster_location ZONE_REGION
      ```

      Replace <var translate="no">ZONE_REGION</var> with the
      [zone or region](https://docs.cloud.google.com/compute/docs/regions-zones.md.txt#available)
      of your cluster.
   4. If you created and use a new namespace other than the `default` namespace,
      you can set that namespace as the default in Google Cloud CLI so that it's
      used each time you run a command:

      ```bash
      gcloud config set run/namespace NAMESPACE
      ```

      Replace <var translate="no">NAMESPACE</var> with the name of the namespace that you want
      the gcloud CLI tool to use by default.
3. Install the `kubectl` command-line tool:

   ```bash
   gcloud components install kubectl
   ```
4. Optional: Ensure that all previously installed components are up-to-date:

   ```bash
   gcloud components update
   ```