第1章 Camel K インテグレーションの管理
Camel K コマンドラインまたは開発ツールを使用して、Red Hat Integration - Camel K インテグレーションを管理できます。本章では、コマンドラインで Camel K インテグレーションを管理する方法を説明し、VS Code 開発ツールの使用方法を説明する追加のリソースへのリンクを提供します。
1.1. Camel K インテグレーションの管理
コマンドラインで OpenShift クラスターの Camel K インテグレーションを管理するためのさまざまなオプションがあります。ここでは、以下のコマンドを使用する簡単な例を紹介します。
-
kamel get
-
kamel describe
-
kamel log
-
kamel delete
前提条件
- Setting up your Camel K development environment
- Java または YAML DSL で記述された Camel インテグレーションが作成済みである必要があります。
手順
以下の例のように、Camel K Operator が OpenShift クラスターで稼働していることを確認します。
oc get pod
oc get pod
Copy to Clipboard Copied! 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
Copy to Clipboard Copied! kamel run
コマンドを入力し、OpenShift のクラウドでインテグレーションを実行します。以下に例を示します。kamel run hello.camelk.yaml
kamel run hello.camelk.yaml
Copy to Clipboard Copied! integration "hello" created
integration "hello" created
Copy to Clipboard Copied! kamel get
コマンドを入力し、インテグレーションの状態を確認します。<<<<<<< HEAD $ kamel get NAME PHASE KIT hello Building Kit myproject/kit-c4ci6mbe9hl5ph5c9sjg ======= kamel get
<<<<<<< HEAD $ kamel get NAME PHASE KIT hello Building Kit myproject/kit-c4ci6mbe9hl5ph5c9sjg ======= kamel get
Copy to Clipboard Copied! NAME PHASE KIT hello Building Kit kit-bqatqib5t4kse5vukt40 >>>>>>> fusedoc-4502
NAME PHASE KIT hello Building Kit kit-bqatqib5t4kse5vukt40 >>>>>>> fusedoc-4502
Copy to Clipboard Copied! kamel describe
コマンドを入力し、インテグレーションに関する詳細情報を出力します。<<<<<<< HEAD $ kamel describe it hello ======= kamel describe integration hello
<<<<<<< HEAD $ kamel describe it hello ======= kamel describe integration hello
Copy to Clipboard Copied! >>>>>>> fusedoc-4502 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.4.0 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
>>>>>>> fusedoc-4502 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.4.0 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
Copy to Clipboard Copied! kamel log
コマンドを入力して、ログをstdout
に出力します。kamel log hello
kamel log hello
Copy to Clipboard Copied! ... [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] ...
Copy to Clipboard Copied! -
Ctrl-C
キーを押して、ターミナルでログインを終了します。 kamel delete
を入力して、OpenShift にデプロイされたインテグレーションを削除します。kamel delete hello
kamel delete hello
Copy to Clipboard Copied! Integration hello deleted
Integration hello deleted
Copy to Clipboard Copied!
その他のリソース
- ロギングの詳細は、「Managing Camel K integration logging levels」を参照してください。
- デプロイメントのターンアラウンド時間を短縮するには、「Running Camel K integrations in development mode」を参照してください。
- インテグレーションを管理するための開発ツールの詳細は、Red Hat による Apache Camel K の VS Code ツール を参照してください。