第 2 章 创建功能
			在构建和部署功能之前,您必须创建它。您可以使用 Knative (kn) CLI 创建功能。
		
2.1. 使用 Knative CLI 创建功能
复制链接链接已复制到粘贴板!
				您可以在命令行中以标志形式指定函数的路径、运行时、模板和镜像 registry,或者使用 a -c 标志在终端中启动交互式体验。
			
先决条件
- 在集群中安装了 OpenShift Serverless Operator 和 Knative Serving。
- 
						已安装 Knative (kn) CLI。
流程
- 创建功能项目: - kn func create -r <repository> -l <runtime> -t <template> <path> - $ kn func create -r <repository> -l <runtime> -t <template> <path>- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 
								可接受的运行时值包括 quarkus、node、typescript、go、python、springboot和rust。
- 可接受的模板值包括 - http和- cloudevents。- 示例命令 - kn func create -l typescript -t cloudevents examplefunc - $ kn func create -l typescript -t cloudevents examplefunc- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 输出示例 - Created typescript function in /home/user/demo/examplefunc - Created typescript function in /home/user/demo/examplefunc- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 或者,您可以指定包含自定义模板的存储库。 - 示例命令 - kn func create -r https://github.com/boson-project/templates/ -l node -t hello-world examplefunc - $ kn func create -r https://github.com/boson-project/templates/ -l node -t hello-world examplefunc- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - 输出示例 - Created node function in /home/user/demo/examplefunc - Created node function in /home/user/demo/examplefunc- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
 
- 
								可接受的运行时值包括