Red Hat Camel K is deprecated
Red Hat Camel K is deprecated and the End of Life date for this product is June 30, 2025. For help migrating to the current go-to solution, Red Hat build of Apache Camel, see the Migration Guide.第 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 日志
-
kamel delete
前提条件
- 设置 Camel K 开发环境
- 您必须具有用 Java 或 YAML DSL 编写的 Camel 集成
流程
确保 Camel K Operator 在您的 OpenShift 集群上运行,例如:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc get pod
oc get pod
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NAME READY STATUS RESTARTS AGE camel-k-operator-86b8d94b4-pk7d6 1/1 Running 0 6m28s
NAME READY STATUS RESTARTS AGE camel-k-operator-86b8d94b4-pk7d6 1/1 Running 0 6m28s
输入
kamel run
命令,在 OpenShift 上的云中运行您的集成。例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow kamel run hello.camelk.yaml
kamel run hello.camelk.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow integration "hello" created
integration "hello" created
输入
kamel get
命令检查集成状态:Copy to Clipboard Copied! Toggle word wrap Toggle overflow kamel get
kamel get
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NAME PHASE KIT hello Building Kit kit-bqatqib5t4kse5vukt40
NAME PHASE KIT hello Building Kit kit-bqatqib5t4kse5vukt40
输入
kamel describe
命令来打印有关集成的详细信息:Copy to Clipboard Copied! Toggle word wrap Toggle overflow kamel describe integration hello
kamel describe integration hello
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
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
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow kamel log hello
kamel log hello
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ... [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] ...
... [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 中部署的集成:Copy to Clipboard Copied! Toggle word wrap Toggle overflow kamel delete hello
kamel delete hello
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Integration hello deleted
Integration hello deleted
其他资源
- 有关日志记录的详情,请参阅管理 Camel K 集成日志记录级别
- 有关更快速的部署周转时间,请参阅 在开发模式下运行 Camel K 集成
- 有关管理集成的开发工具的详情,请参阅 Red Hat Apache Camel K 的 VS Code 工具