This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.4.7. Installing the Knative CLI (kn)
kn
does not have its own login mechanism. To log in to the cluster, you must install the oc
CLI and use oc
login.
Installation options for the oc
CLI will vary depending on your operating system.
For more information on installing the oc
CLI for your operating system and logging in with oc
, see the CLI getting started documentation.
Once the OpenShift Serverless Operator is installed, you will see a link to download the kn
CLI for Linux, macOS and Windows from the Command Line Tools page in the OpenShift Container Platform web console.
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 drop down menu.
Procedure
-
Download the
kn
CLI from the Command Line Tools page. Unpack the archive:
tar -xf <file>
$ tar -xf <file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Move the
kn
binary to a directory on your PATH. To check your path, run:
echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意If you do not use 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:
kn: No such file or directory
$ kn: No such file or directory
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.7.2. Installing the kn CLI for Linux using an RPM 复制链接链接已复制到粘贴板!
For Red Hat Enterprise Linux (RHEL), you can install kn
as an RPM if you have an active OpenShift Container Platform subscription on your Red Hat account.
Procedure
-
Use the following command to install
kn
:
subscription-manager register subscription-manager refresh subscription-manager attach --pool=<pool_id> subscription-manager repos --enable="openshift-serverless-1-for-rhel-8-x86_64-rpms" yum install openshift-serverless-clients
# subscription-manager register
# subscription-manager refresh
# subscription-manager attach --pool=<pool_id>
# subscription-manager repos --enable="openshift-serverless-1-for-rhel-8-x86_64-rpms"
# yum install openshift-serverless-clients
- 1
- Pool ID for an active OpenShift Container Platform subscription
4.7.3. Installing the kn CLI for Linux 复制链接链接已复制到粘贴板!
For Linux distributions, you can download the CLI directly as a tar.gz
archive.
Procedure
- Download the CLI.
Unpack the archive:
tar -xf <file>
$ tar -xf <file>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Move the
kn
binary to a directory on your PATH. To check your path, run:
echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意If you do not use 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:
kn: No such file or directory
$ kn: No such file or directory
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.7.4. Installing the kn CLI for macOS 复制链接链接已复制到粘贴板!
kn
for macOS is provided as a tar.gz
archive.
Procedure
- Download the CLI.
- Unpack and unzip the archive.
-
Move the
kn
binary to a directory on your PATH. To check your PATH, open a terminal window and run:
echo $PATH
$ echo $PATH
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.7.5. Installing the kn CLI for Windows 复制链接链接已复制到粘贴板!
The CLI for Windows is provided as a zip archive.
Procedure
- Download the CLI.
- Unzip 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:
path
C:\> path
Copy to Clipboard Copied! Toggle word wrap Toggle overflow