下载 kn

# wget https://github.com/knative/client/releases/download/knative-v1.11.0/kn-linux-amd64

部署 kn

# mv kn-linux-amd64 /usr/local/bin/kn
# chmod +x /usr/local/bin/kn

验证 kn

# kn version
Version:      v1.11.0
Build Date:   2023-07-27 07:42:56
Git Revision: b7508e67
Supported APIs:
* Serving
  - serving.knative.dev/v1 (knative-serving v1.11.0)
* Eventing
  - sources.knative.dev/v1 (knative-eventing v1.11.0)
  - eventing.knative.dev/v1 (knative-eventing v1.11.0)

kn 插件

kn 常用插件

kn-plugin-admin:管理Kubernetes集群上部署的knative
kn-plugin-quickstart:帮助用户快速设定本地可用的Knative环境
kn-plugin-source-kafka:管理由eventing-kafka安装的Kafka Source
kn-plugin-source-kamelet:管理由Camel-K安装的Kamelet Sources
kn-plugin-event:于集群上或集群外部生成CloudEvents
kn-plugin-diag: 用于通过公开 Knative 对象不同层的详细信息来诊断问题
kn-plugin-func: 函数插件
kn-plugin-migration: 用于将 Knative 服务从一个集群迁移到另一个集群
kn-plugin-operator: 使用 Knative Operator 管理 Knative
kn-plugin-service-log: 显示 Knative Services 的标准输出

kn 插件安装步骤

1. 从 GitHub 下载该插件的当前版本。
2. 重命名该文件。例如,重命名kn-admin-darwin-amd64为kn-admin.
3. 使插件可执行。例如,chmod +x kn-admin.
4. 将文件移动到您的PATH. 例如,/usr/local/bin.

kn 插件下载地址

https://github.com/knative-extensions

查看本地kn插件

# kn plugin list

kn 使用说明

# kn --help
kn is the command line interface for managing Knative Serving and Eventing resources

Find more information about Knative at: https://knative.dev

Serving Commands:
  service      管理Knative services
  revision     管理Knative revisions
  route        管理Knative routes
  domain       管理域名映射
  container    管理KService的容器 (experimental)

Eventing Commands:
  source       Manage event sources
  broker       Manage message brokers
  trigger      Manage event triggers
  channel      Manage event channels
  subscription Manage event subscriptions
  eventtype    Manage eventtypes

Other Commands:
  plugin       Manage kn plugins
  secret       Manage secrets
  completion   Output shell completion code
  version      Show the version of this client


Use "kn <command> --help" for more information about a given command.
Use "kn options" for a list of global command-line options (applies to all commands).

参考文档

https://knative.dev/docs/client/install-kn/