$ kn: No such file or directory
The Knative (kn
) cli does not have its own login mechanism. To log in to the cluster, you must install the OpenShift cli (oc
) and use the oc login
command. Installation options for the clis may vary depending on your operating system.
For more information on installing the OpenShift cli (oc
) for your operating system and logging in with oc
, see the OpenShift cli getting started documentation.
OpenShift Serverless cannot be installed using the Knative (kn
) cli. A cluster administrator must install the OpenShift Serverless Operator and set up the Knative components, as described in the Installing the OpenShift Serverless Operator documentation.
If you try to use an older version of the Knative ( For example, if you use the 1.23.0 release of the Knative ( Ensure that you are using the latest Knative ( |
Using the OpenShift Container Platform web console provides a streamlined and intuitive user interface to install the Knative (kn
) cli. After the OpenShift Serverless Operator is installed, you will see a link to download the Knative (kn
) cli for Linux (amd64, s390x, ppc64le), macOS, or Windows from the Command Line Tools page in the OpenShift Container Platform web console.
You have logged in to the OpenShift Container Platform web console.
The OpenShift Serverless Operator and Knative Serving are installed on your OpenShift Container Platform cluster.
If libc is not available, you might see the following error when you run cli commands:
|
If you want to use the verification steps for this procedure, you must install the OpenShift (oc
) cli.
Download the Knative (kn
) cli from the Command Line Tools page. You can access the Command Line Tools page by clicking the icon in the top right corner of the web console and selecting Command Line Tools in the list.
Unpack the archive:
$ tar -xf <file>
Move the kn
binary to a directory on your PATH
.
To check your PATH
, run:
$ echo $PATH
Run the following commands to check that the correct Knative cli resources and route have been created:
$ oc get ConsolecliDownload
NAME DISPLAY NAME AGE
kn kn - OpenShift Serverless Command Line Interface (cli) 2022-09-20T08:41:18Z
oc-cli-downloads oc - OpenShift Command Line Interface (cli) 2022-09-20T08:00:20Z
$ oc get route -n openshift-serverless
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
kn kn-openshift-serverless.apps.example.com knative-openshift-metrics-3 http-cli edge/Redirect None
For Red Hat Enterprise Linux (RHEL), you can install the Knative (kn
) cli as an RPM by using a package manager, such as yum
or dnf
. This allows the Knative cli version to be automatically managed by the system. For example, using a command like dnf upgrade
upgrades all packages, including kn
, if a new version is available.
You have an active OpenShift Container Platform subscription on your Red Hat account.
Register with Red Hat Subscription Manager:
# subscription-manager register
Pull the latest subscription data:
# subscription-manager refresh
Attach the subscription to the registered system:
# subscription-manager attach --pool=<pool_id> (1)
1 | Pool ID for an active OpenShift Container Platform subscription |
Enable the repositories required by the Knative (kn
) cli:
Linux (x86_64, amd64)
# subscription-manager repos --enable="openshift-serverless-1-for-rhel-8-x86_64-rpms"
Linux on IBM zSystems and IBM® LinuxONE (s390x)
# subscription-manager repos --enable="openshift-serverless-1-for-rhel-8-s390x-rpms"
Linux on IBM Power (ppc64le)
# subscription-manager repos --enable="openshift-serverless-1-for-rhel-8-ppc64le-rpms"
Install the Knative (kn
) cli as an RPM by using a package manager:
yum
command# yum install openshift-serverless-clients
You might require to use Knative (kn
) cli version that is not the most recent, but is in Maintenance Phase. You can achieve that by locking the version of kn
, which prevents it from being upgraded.
Install the versionlock
plugin for the DNF package manager:
# dnf install 'dnf-command(versionlock)'
Lock the version of kn
by running:
# dnf versionlock add --raw 'openshift-serverless-clients-1.7.*'
This command locks kn
to be the version based on Knative 1.7, which is in Maintenance Phase at the time of release of OpenShift Serverless 1.29.
You can manually upgrade the Knative (kn
) cli version that has previously been version-locked.
Check whether upgraded packages are available:
# dnf search --showduplicates openshift-serverless-clients
Remove the version lock of kn
:
# dnf versionlock delete openshift-serverless-clients
Lock kn
to the new version:
# dnf versionlock add --raw 'openshift-serverless-clients-1.8.*'
+
This example uses the kn
version that is based on Knative 1.8.
Upgrade to the new available version:
# dnf install --upgrade openshift-serverless-clients
If you are using a Linux distribution that does not have RPM or another package manager installed, you can install the Knative (kn
) cli as a binary file. To do this, you must download and unpack a tar.gz
archive and add the binary to a directory on your PATH
.
If you are not using RHEL or Fedora, ensure that libc is installed in a directory on your library path.
If libc is not available, you might see the following error when you run cli commands:
|
Download the relevant Knative (kn
) cli tar.gz
archive:
You can also download any version of kn
by navigating to that version’s corresponding directory in the Serverless client download mirror.
Unpack the archive:
$ tar -xf <filename>
Move the kn
binary to a directory on your PATH
.
To check your PATH
, run:
$ echo $PATH
If you are using macOS, you can install the Knative (kn
) cli as a binary file. To do this, you must download and unpack a tar.gz
archive and add the binary to a directory on your PATH
.
Download the Knative (kn
) cli tar.gz
archive.
You can also download any version of kn
by navigating to that version’s corresponding directory in the Serverless client download mirror.
Unpack and extract the archive.
Move the kn
binary to a directory on your PATH
.
To check your PATH
, open a terminal window and run:
$ echo $PATH
If you are using Windows, you can install the Knative (kn
) cli as a binary file. To do this, you must download and unpack a ZIP archive and add the binary to a directory on your PATH
.
Download the Knative (kn
) cli ZIP archive.
You can also download any version of kn
by navigating to that version’s corresponding directory in the Serverless client download mirror.
Extract the archive with a ZIP program.
Move the kn
binary to a directory on your PATH
.
To check your PATH
, open the command prompt and run the command:
C:\> path