第5章 Camel K インテグレーションの管理

Camel K コマンドラインまたは開発ツールを使用して、Red Hat Integration - Camel K インテグレーションを管理できます。本章では、コマンドラインで Camel K インテグレーションを管理する方法を説明し、VS Code 開発ツールの使用方法を説明する追加のリソースへのリンクを提供します。

5.1. Camel K インテグレーションの管理

コマンドラインで OpenShift クラスターの Camel K インテグレーションを管理するためのさまざまなオプションがあります。ここでは、以下のコマンドを使用する簡単な例を紹介します。

  • kamel get
  • kamel describe
  • kamel ログ
  • kamel delete

前提条件

手順

  1. 以下の例のように、Camel K Operator が OpenShift クラスターで稼働していることを確認します。

    $ oc get pod
    NAME                               READY   STATUS    RESTARTS   AGE
    camel-k-operator-86b8d94b4-pk7d6   1/1     Running   0          6m28s
  2. kamel run コマンドを入力し、OpenShift のクラウドでインテグレーションを実行します。以下に例を示します。

    $ kamel run hello.camelk.yaml
    integration "hello" created
  3. kamel get コマンドを入力し、インテグレーションの状態を確認します。

    $ kamel get
    NAME   PHASE        KIT
    hello  Building Kit kit-bqatqib5t4kse5vukt40
  4. kamel describe コマンドを入力し、インテグレーションに関する詳細情報を出力します。

    $ kamel describe integration hello
    kamel describe integration hello
    Name:                hello
    Namespace:           camel-k-test
    Creation Timestamp:  Tue, 14 Apr 2020 16:57:04 +0100
    Phase:               Running
    Runtime Version:     1.1.0
    Kit:                 kit-bqatqib5t4kse5vukt40
    Image:               image-registry.openshift-image-registry.svc:5000/camel-k-test/camel-k-kit-bqatqib5t4kse5vukt40@sha256:3788d571e6534ab27620b6826e6a4f10c23fc871d2f8f60673b7c20e617d6463
    Version:             1.0.0-RC2
    Dependencies:
      camel:log
      camel:timer
      mvn:org.apache.camel.k/camel-k-loader-yaml
      mvn:org.apache.camel.k/camel-k-runtime-main
    Sources:
      Name               Language  Compression  Ref  Ref Key
      hello.camelk.yaml  yaml      false
    Conditions:
      Type                          Status  Reason                        Message
      IntegrationPlatformAvailable  True    IntegrationPlatformAvailable  camel-k
      IntegrationKitAvailable       True    IntegrationKitAvailable       kit-bqatqib5t4kse5vukt40
      CronJobAvailable              False   CronJobNotAvailableReason     different controller strategy used (deployment)
      DeploymentAvailable           True    DeploymentAvailable           deployment name is hello
      ServiceAvailable              False   ServiceNotAvailable           no http service required
      ExposureAvailable             False   RouteNotAvailable             no target service found
  5. kamel log コマンドを入力して、ログを stdout に出力します。

    $ kamel log hello
    ...
    1] 2020-04-14 16:03:41.205 INFO  [Camel (camel-k) thread #1 - timer://yaml] info - Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello Camel K from yaml]
    [1] 2020-04-14 16:03:42.205 INFO  [Camel (camel-k) thread #1 - timer://yaml] info - Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello Camel K from yaml]
    [1] 2020-04-14 16:03:43.204 INFO  [Camel (camel-k) thread #1 - timer://yaml] info - Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello Camel K from yaml]
    ...
  6. Ctrl-C キーを押して、ターミナルでログインを終了します。
  7. kamel delete を入力して、OpenShift にデプロイされたインテグレーションを削除します。

    $ kamel delete hello
    Integration hello deleted

関連情報