Install the Kf CLI

This document describes how to install the Kf CLI. You typically install the Kf CLI when you already have access to a GKE cluster running Kf. That means that you can get started using Kf commands without having to first create your own GKE cluster.

After installing the Kf CLI and connecting to the Kf cluster, you can run any of the Kf commands. For a complete list of the available Kf commands, see the Kf command reference.

Before you begin

Before you can use the Kf CLI, you must have access to a GKE cluster running a full Kf installation. That means that you have run the following command to connect to the cluster:

gcloud container clusters get-credentials CLUSTER_NAME \
    --project=CLUSTER_PROJECT_ID \
    --zone=CLUSTER_LOCATION

Install the CLI

  1. Install the Kf CLI:

    Linux

    This command installs the Kf CLI for all users on the system. Follow the instructions in the Cloud Shell tab to install it just for yourself.

    gcloud storage cp gs://kf-releases/v2.9.0/kf-linux /tmp/kf
    chmod a+x /tmp/kf
    sudo mv /tmp/kf /usr/local/bin/kf

    Mac

    This command installs kf for all users on the system.

    gcloud storage cp gs://kf-releases/v2.9.0/kf-darwin /tmp/kf
    chmod a+x /tmp/kf
    sudo mv /tmp/kf /usr/local/bin/kf

    Cloud Shell

    This command installs kf on your Cloud Shell instance if you use bash, the instructions may need to be modified for other shells.

    mkdir -p ~/bin
    gcloud storage cp gs://kf-releases/v2.9.0/kf-linux ~/bin/kf
    chmod a+x ~/bin/kf
    echo "export PATH=$HOME/bin:$PATH" >> ~/.bashrc
    source ~/.bashrc

    Windows

    This command downloads kf to current directory. Add it to the path if you want to call if from anywhere other than the current directory.

    gcloud storage cp gs://kf-releases/v2.9.0/kf-windows.exe kf.exe

Upgrade the CLI

If you have an existing installation of the Kf CLI, then you can use the following procedure to upgrade it to the current version.

  1. Install the CLI:

    Linux

    This command installs the Kf CLI for all users on the system. Follow the instructions in the Cloud Shell tab to install it just for yourself.

    gcloud storage cp gs://kf-releases/v2.9.0/kf-linux /tmp/kf
    chmod a+x /tmp/kf
    sudo mv /tmp/kf /usr/local/bin/kf

    Mac

    This command installs kf for all users on the system.

    gcloud storage cp gs://kf-releases/v2.9.0/kf-darwin /tmp/kf
    chmod a+x /tmp/kf
    sudo mv /tmp/kf /usr/local/bin/kf

    Cloud Shell

    This command installs kf on your Cloud Shell instance if you use bash, the instructions may need to be modified for other shells.

    mkdir -p ~/bin
    gcloud storage cp gs://kf-releases/v2.9.0/kf-linux ~/bin/kf
    chmod a+x ~/bin/kf
    echo "export PATH=$HOME/bin:$PATH" >> ~/.bashrc
    source ~/.bashrc

    Windows

    This downloads kf to current directory. Add it to the path if you want to call if from anywhere other than the current directory.

    gcloud storage cp gs://kf-releases/v2.9.0/kf-windows.exe kf.exe
  2. Validate the Kf CLI and Kf server versions match:

    • The CLI version is listed under Kf Client.
    • The Kf server version is listed under kf["app.kubernetes.io/version"].
    $ kf debug
    ...
    Version:
      Kf Client:                        v2.9.0
      Server version:                   v1.21.6-gke.1500
      kf["app.kubernetes.io/version"]:  v2.9.0
    ...