kn
is the Knative command line interface (CLI).
You can grab the latest nightly binary executable for:
Put it on your system path, and make sure it's executable.
Alternatively, check out the client repository, and type:
go install ./cmd/kn
To use the kn container image:
- Nightly:
gcr.io/knative-nightly/knative.dev/client/cmd/kn
- Latest release:
gcr.io/knative-releases/knative.dev/client/cmd/kn
You'll need a kubectl
-style config file to connect to your cluster.
- Starting minikube writes this file (or gives you an appropriate context in an existing config file)
- Instructions for Google GKE
- Instructions for Amazon EKS
- Instructions for IBM IKS
- Instructions for Red Hat OpenShift.
- Or contact your cluster administrator.
kn
will pick up your kubectl
config file in the default location of $HOME/.kube/config
. You can specify an alternate kubeconfig connection file with --kubeconfig
, or the env var $KUBECONFIG
, for any command.
There are a set of configuration parameters you can setup to better customize kn
. In particular, you can specify where your kn
plugins are located and how they are found. The kn
configuration file is meant to capture these configuration options. Let's explore this file's location, and the options you are able to change with it.
The default location kn
looks for config is under the home directory of the user at $HOME/.kn/config.yaml
. It is not created for you as part of the kn
installation. You can create this file elsewhere and use the --config
flag to specify its path.
There are two options you can specify in the kn
config file and they are related to how kn
locates plugins.
-
pluginsDir
which is the same as the persistent flag--plugins-dir
and specifies the kn plugins directory. It defaults to:~/.kn/plugins
. By using the persistent flag (when you issue a command) or by specifying the value in thekn
config, a user can select which directory to findkn
plugins. It can be any directory that is visible to the user. -
lookupPluginsInPath
which is the same as the persistent flag--lookup-plugins-in-path
and specficies ifkn
should look for plugins anywhere in the specifiedPATH
environment variable. This is a boolean configuration option and the default value isfalse
.
For example, the following kn
config will look for kn
plugins in the user's PATH
and also execute plugin in ~/.kn/plugins
.
cat ~/.kn/config.yaml
lookupPluginsInPath: true
pluginsdir: ~/.kn/plugins
- See the generated documentation
- See the documentation on managing
kn
Kn supports plugins, which allow you to extend the functionality of your kn
installation with custom commands as well as shared commands that are not part of the core distribution of kn
. See the plugins documentation for more information.