2.3.6. サービス CA バンドルの変更用 Webhook 設定への追加

MutatingWebhookConfiguration オブジェクトに service.beta.openshift.io/inject-cabundle=true のアノテーションを付け、各 Webhook の clientConfig.caBundle フィールドにサービス CA バンドルを設定できます。これにより、Kubernetes API サーバーはターゲットに設定されたエンドポイントのセキュリティーを保護するために使用されるサービス CA 証明書を検証することができます。

注記

異なる Webhook に異なる CA バンドルを指定する必要がある受付 Webhook 設定にはこのアノテーションを設定しないでください。これを実行する場合、サービス CA バンドルはすべての Webhook について挿入されます。

手順

  1. 変更用 Webhook 設定に service.beta.openshift.io/inject-cabundle=true のアノテーションを付けます。

    $ oc annotate mutatingwebhookconfigurations <mutating_webhook_name> \1
         service.beta.openshift.io/inject-cabundle=true
    1
    <mutatingwebhook-name> を、アノテーションを付ける変更用 webhook 設定の名前に置き換えます。

    たとえば、以下のコマンドを使用して変更用 webhook 設定 test1 にアノテーションを付けます。

    $ oc annotate mutatingwebhookconfigurations test1 service.beta.openshift.io/inject-cabundle=true
  2. 変更用 webhook 設定を表示して、サービス CA バンドルが挿入されていることを確認します。

    $ oc get mutatingwebhookconfigurations <mutating_webhook_name> -o yaml

    CA バンドルは、YAML 出力のすべての Webhook の clientConfig.caBundle フィールドに表示されます。

    apiVersion: admissionregistration.k8s.io/v1
    kind: MutatingWebhookConfiguration
    metadata:
      annotations:
        service.beta.openshift.io/inject-cabundle: "true"
    ...
    webhooks:
    - myWebhook:
      - v1beta1
      clientConfig:
        caBundle: <CA_BUNDLE>
    ...