第 1 章 管理 Camel K 集成
您可以使用 Camel K 命令行或使用开发工具来管理红帽集成 - Camel K 集成。本章解释了如何在命令行中管理 Camel K 集成,并提供解释了如何使用 VS Code 开发工具的其他资源的链接。
1.1. 管理 Camel K 集成
Camel K 提供在命令行上在 OpenShift 集群上管理 Camel K 集成的不同选项。本节展示了使用以下命令的简单示例:
-
kamel get -
kamel describe -
kamel log -
kamel delete
先决条件
- 设置 Camel K 开发环境
- 您必须已经使用 Java 或 YAML DSL 编写 Camel 集成
流程
确保 Camel K Operator 在 OpenShift 集群中运行,例如:
oc get pod
NAME READY STATUS RESTARTS AGE camel-k-operator-86b8d94b4-pk7d6 1/1 Running 0 6m28s
输入
kamel run命令,以在 OpenShift 的云中运行您的集成。例如:kamel run hello.camelk.yaml
integration "hello" created
输入
kamel get命令检查集成的状态:kamel get
NAME PHASE KIT hello Building Kit kit-bqatqib5t4kse5vukt40
输入
kamel describe命令来打印有关集成的详细信息:kamel describe integration hello
Name: hello Namespace: myproject Creation Timestamp: Fri, 13 Aug 2021 16:23:21 +0200 Phase: Building Kit Runtime Version: 1.7.1.fuse-800025-redhat-00001 Kit: myproject/kit-c4ci6mbe9hl5ph5c9sjg Image: Version: 1.6.6 Dependencies: camel:core camel:log camel:timer mvn:org.apache.camel.k:camel-k-runtime mvn:org.apache.camel.quarkus:camel-quarkus-yaml-dsl Sources: Name Language Compression Ref Ref Key camel-k-embedded-flow.yaml yaml false Conditions: Type Status Reason Message IntegrationPlatformAvailable True IntegrationPlatformAvailable myproject/camel-k IntegrationKitAvailable True IntegrationKitAvailable kit-c4ci6mbe9hl5ph5c9sjg CronJobAvailable False CronJobNotAvailableReason different controller strategy used (deployment) DeploymentAvailable True DeploymentAvailable deployment name is hello KnativeServiceAvailable False KnativeServiceNotAvailable different controller strategy used (deployment) Ready True ReplicaSetReady
输入
kamel log命令将日志输出到stdout:kamel log hello
... [1] 2021-08-13 14:37:15,860 INFO [info] (Camel (camel-1) thread #0 - timer://yaml) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello Camel K from yaml] ...
-
按
Ctrl-C终止终端中的日志记录。 输入
kamel delete以删除在 OpenShift 上部署的集成:kamel delete hello
Integration hello deleted
其他资源
- 有关日志记录的详情,请参阅管理 Camel K 集成日志记录级别
- 有关更快地部署时间,请参阅在 开发模式下运行 Camel K 集成
- 有关管理集成的开发工具的详情,请参阅 Apache Camel K 的 VS Code Tooling for Apache Camel K by Red Hat