Azure AKS に BYOC Logs をインストールする

This product is not supported for your selected Datadog site. ().

概要

このドキュメントでは、Azure 環境を構成し、Azure AKS に BYOC (Bring Your Own Cloud) Logs をインストールするプロセスについて説明します。

前提条件

Azure に BYOC Logs をインストールする前に、サポート用インフラストラクチャーリソースをセットアップする必要があります。これらのコンポーネントは、BYOC Logs が依存する基盤となるコンピューティング、ストレージ、データベース、およびネットワークサービスを提供します。

インフラストラクチャー要件

プロビジョニングする必要があるコンポーネントは次のとおりです。

  • Azure Kubernetes Service (AKS): 予想される BYOC Logs ワークロードに合わせてサイズ設定された、実行中の AKS クラスター。
  • PostgreSQL Flexible Server: BYOC Logs がメタデータの保存に使用する Azure Database for PostgreSQL インスタンス。
  • Blob Storage コンテナ: BYOC Logs データを保存するための Azure Storage コンテナ。
  • クライアント ID と権限: ストレージコンテナへの読み取り/書き込みアクセス権を持つ Azure AD アプリケーション。
  • NGINX Ingress Controller: 外部トラフィックを BYOC Logs サービスにルーティングするために AKS クラスターにインストールされます。
  • Datadog Agent: ログを収集して BYOC Logs に送信するために AKS クラスターにデプロイされます。

Azure Kubernetes Service (AKS)

BYOC Logs は完全に Kubernetes 上で実行されます。ワークロード用に構成された、十分な CPU、メモリ、ディスク容量を備えた AKS クラスターが必要です。ガイダンスについては、Kubernetes クラスターのサイジングに関する推奨事項を参照してください。

AKS クラスターをデプロイする

クラスターの接続性と正常性を確認する

クラスターに到達可能であり、ノードが Ready 状態であることを確認するには、次のコマンドを実行します。

kubectl get nodes -o wide

Azure PostgreSQL Flexible Server

BYOC Logs は、そのメタデータと構成を PostgreSQL データベースに保存します。Datadog は、Azure Database for PostgreSQL Flexible Server を推奨します。AKS クラスターから到達可能である必要があり、理想的にはプライベートネットワークが有効になっている必要があります。詳細については、Postgres のサイジングに関する推奨事項を参照してください。

PostgreSQL データベースを作成する

データベースの接続性を確認する

セキュリティのため、BYOC Logs 専用のデータベースとユーザーを作成し、クラスター全体ではなく、そのデータベースに対してのみユーザー権限を付与してください。

PostgreSQL クライアントを使用して、AKS ネットワーク内から PostgreSQL データベースに接続します psql。まず、psql を含むイメージを使用して、Kubernetes クラスター内で対話型 Pod を起動します。

kubectl run psql-client \
  -n <NAMESPACE_NAME> \
  --rm -it \
  --image=bitnami/postgresql:latest \
  --command -- bash

次に、プレースホルダーの値を実際の値に置き換えて、シェルから直接次のコマンドを実行します。

psql "host=<HOST> \
      port=<PORT> \
      dbname=<DATABASE> \
      user=<USERNAME> \
      password=<PASSWORD>"

成功すると、次のようなプロンプトが表示されます。

psql (15.2)
SSL connection (protocol: TLS...)
Type "help" for help.

<DATABASE>=>

Blob ストレージコンテナ

BYOC Logs は、ログを永続化するために Azure Blob Storage を使用します。この目的用に専用のコンテナを作成します。

Blob Storage コンテナを作成する

環境ごとに専用のコンテナを使用し (例: byoc-logs-prod、byoc-logs-staging)、ストレージアカウントのスコープではなく、コンテナレベルで最小権限の RBAC ロールを割り当てます。

クライアント ID と権限

Azure AD アプリケーションには、Blob Storage コンテナへの読み取り/書き込みアクセス権を付与する必要があります。BYOC Logs 用に専用のアプリケーションを登録し、対応するサービスプリンシパルに、上記で作成した Blob Storage コンテナに対する Contributor ロールを割り当てます。

アプリケーションを登録する

Microsoft Entra ID にアプリケーションを登録する

共同作成者ロールを割り当てる

blob データへのアクセスのための Azure ロールを割り当てる

NGINX Ingress Controller

Public NGINX Ingress Controller

パブリックイングレスは、Datadog がパブリックインターネット経由で BYOC Logs クラスターを管理およびクエリするために不可欠です。これは、以下のメカニズムを通じて BYOC Logs gRPC API への安全なアクセスを提供します。

  • Datadog サービスからのトラフィックを受け入れるインターネット向け Azure Load Balancer を作成します
  • Ingress コントローラーレベルでの終端処理を伴う TLS 暗号化を実装します
  • Datadog と BYOC Logs クラスター間の通信に HTTP/2 (gRPC) を使用します
  • Datadog サービスが有効なクライアント証明書を提示する必要がある、相互 TLS (mTLS) 認証を要求します
  • コントローラーを TLS パススルーモードで構成し、ssl-client-cert ヘッダーを使用してクライアント証明書を BYOC Logs Pod に転送します
  • 有効なクライアント証明書または証明書ヘッダーがないリクエストを拒否します

Public NGINX Ingress Controller を作成するには、次の nginx-public.yaml Helm 値ファイルを使用します。

nginx-public.yaml

controller:
  electionID: public-ingress-controller-leader
  ingressClass: nginx-public
  ingressClassResource:
    name: nginx-public
    enabled: true
    default: false
    controllerValue: k8s.io/public-ingress-nginx
  service:
    type: LoadBalancer
    annotations:
      service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path: /healthz

次に、以下のコマンドを使用して Helm でコントローラーをインストールします。

helm upgrade --install nginx-public ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace nginx-ingress-public \
  --create-namespace \
  -f nginx-public.yaml

コントローラー Pod が実行されていることを確認します。

kubectl get pods -n nginx-ingress-public -l app.kubernetes.io/component=controller

サービスが外部 IP を公開していることを確認します。

kubectl get svc -n nginx-ingress-public -l app.kubernetes.io/component=controller

Internal NGINX Ingress Controller

内部イングレスにより、Datadog Agents や環境内の他のログコレクターからの HTTP 経由のログ取り込みが可能になります。Public NGINX Ingress Controller を作成するには、次の nginx-internal.yaml Helm 値ファイルを使用します。

nginx-internal.yaml

controller:
  electionID: internal-ingress-controller-leader
  ingressClass: nginx-internal
  ingressClassResource:
    name: nginx-internal
    enabled: true
    default: false
    controllerValue: k8s.io/internal-ingress-nginx
  service:
    type: LoadBalancer
    annotations:
      service.beta.kubernetes.io/azure-load-balancer-internal: true
      service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path: /healthz

次に、以下のコマンドを使用して Helm でコントローラーをインストールします。

helm upgrade --install nginx-internal ingress-nginx \
  --repo https://kubernetes.github.io/ingress-nginx \
  --namespace nginx-ingress-internal \
  --create-namespace \
  -f nginx-internal.yaml

コントローラー Pod が実行されていることを確認します。

kubectl get pods -n nginx-ingress-internal -l app.kubernetes.io/component=controller

サービスが外部 IP を公開していることを確認します。

kubectl get svc -n nginx-ingress-internal -l app.kubernetes.io/component=controller

DNS

オプションで、パブリックロードバランサーの IP を指す DNS エントリを追加できます。これにより、将来 IP が変更されても Datadog 側で構成を更新する必要がなくなります。

インストール手順

  1. BYOC Logs Helm チャートをインストールします
  2. インストールを検証します

BYOC Logs Helm チャートをインストールする

  1. Datadog Helm リポジトリを追加および更新します。

    helm repo add datadog https://helm.datadoghq.com
    helm repo update
    
  2. チャート用の Kubernetes ネームスペースを作成します。

    kubectl create namespace <NAMESPACE_NAME>
    

    たとえば、byoc-logs ネームスペースを作成するには、

    kubectl create namespace byoc-logs
    

    注: 現在のコンテキストのデフォルトネームスペースを設定すると、コマンドごとに -n <NAMESPACE_NAME> を入力する必要がなくなります。

    kubectl config set-context --current --namespace=byoc-logs
    
  3. Datadog API キーを Kubernetes シークレットとして保存します。

    kubectl create secret generic datadog-secret \
    -n <NAMESPACE_NAME> \
    --from-literal api-key="<DD_API_KEY>"
    
  4. PostgreSQL データベース接続文字列を Kubernetes シークレットとして保存します。 PostgreSQL の接続詳細を取得するには、Azure ポータルに移動し、All resources に移動してから、Azure Database for PostgreSQL Flexible Server インスタンスをクリックします。最後に、Getting started タブで、Connect カード内の View connection strings リンクをクリックします。

    kubectl create secret generic byoc-logs-metastore-uri \
      -n <NAMESPACE_NAME> \
      --from-literal QW_METASTORE_URI=postgres://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>
    

    たとえば、metastore-uri シークレットを byoc-logs ネームスペースに保存するには、

    USERNAME=byoc-logs-prod
    PASSWORD=1234567890
    HOST=byoc-logs-prod.postgres.database.azure.com
    PORT=5432
    DATABASE=byoc_logs_prod
    kubectl create secret generic metastore-uri \
      -n byoc-logs \
      --from-literal QW_METASTORE_URI="postgres://$USERNAME:$PASSWORD@$HOST:$PORT/$DATABASE"
    
  5. クライアントシークレットまたはストレージアカウントアクセスキーを Kubernetes シークレットとして保存します。

    kubectl create secret generic <SECRET_NAME> \
      -n <NAMESPACE_NAME> \
      --from-literal <SECRET_KEY>=<SECRET_VALUE>
    
  6. Helm チャートをカスタマイズします。

    datadog-values.yaml ファイルを作成して、デフォルト値をカスタム構成で上書きします。ここでは、イメージタグ、Azure テナント ID、サービスアカウント、イングレス設定、リソースの要求と制限など、環境固有の設定を定義します。

    datadog-values.yaml で明示的にオーバーライドされていないパラメーターは、チャートの values.yaml で定義されているデフォルト値にフォールバックします。

     # Show default values
     helm show values datadog/cloudprem
    

    Azure のオーバーライドを含む datadog-values.yaml ファイルの例を次に示します。

    datadog-values.yaml

    # Datadog configuration
    datadog:
      # The Datadog site (https://docs.datadoghq.com/getting_started/site/) to connect to. Defaults to `datadoghq.com`.
      # site: datadoghq.com
      # The name of the existing Secret containing the Datadog API key. The secret key name must be `api-key`.
      apiKeyExistingSecret: datadog-secret
    
    azure:
      tenantId: <TENANT_ID> # required
      clientId: <CLIENT_ID> # required when using AD App to authenticate with Blob Storage
      clientSecretRef:
        name: <SECRET_NAME>
        key: <SECRET_KEY>
      storageAccount:
        name: <STORAGE_ACCOUNT_NAME> # required
        # If you are using a storage account access key to authenticate with Blob Storage,
        # comment out the `clientSecretRef` section above,
        # and uncomment the `storageAccount` section below:
        # accessKeySecretRef:
          # name: <SECRET_NAME>
          # key: <SECRET_KEY>
    
       # Service account configuration
       # If `serviceAccount.create` is set to `true`, a service account is created with the specified name.
       # Additional annotations can be added using serviceAccount.extraAnnotations.
       serviceAccount:
         create: true
         name: byoc-logs
    
    # BYOC Logs node configuration
    config:
      # The root URI where index data is stored. This should be an Azure path.
      # All indexes created in BYOC Logs are stored under this location.
      default_index_root_uri: azure://<CONTAINER_NAME>/indexes
    
    # Internal ingress configuration
    # The internal ingress NLB is created in private subnets.
    #
    # Additional annotations can be added to customize the ALB behavior.
    ingress:
      # The internal ingress is used by Datadog Agents and other collectors running outside
      # the Kubernetes cluster to send their logs to BYOC Logs.
      internal:
        enabled: true
        ingressClassName: nginx-internal
        host: byoc-logs.acme.internal
        extraAnnotations: {}
    
    # Metastore configuration
    # The metastore is responsible for storing and managing index metadata.
    # It requires a PostgreSQL database connection string to be provided by a Kubernetes secret.
    # The secret should contain a key named `QW_METASTORE_URI` with a value in the format:
    # postgresql://<username>:<password>@<host>:<port>/<database>
    #
    # The metastore connection string is mounted into the pods using extraEnvFrom to reference the secret.
    metastore:
      extraEnvFrom:
        - secretRef:
            name: byoc-logs-metastore-uri
    
    # Indexer configuration
    # The indexer is responsible for processing and indexing incoming data it receives data from various sources (for example, Datadog Agents, log collectors)
    # and transforms it into searchable files called "splits" stored in S3.
    #
    # The indexer is horizontally scalable - you can increase `replicaCount` to handle higher indexing throughput.
    # The `podSize` parameter sets vCPU, memory, and component-specific settings automatically.
    # See the sizing guide for available tiers and their configurations.
    indexer:
      replicaCount: 2
      podSize: xlarge
      persistentVolume:
        enabled: true
        storage: 250Gi
        storageClass: managed-csi
    
       # Searcher configuration
       # The searcher is responsible for executing search queries against the indexed data stored in S3.
       # It handles search requests from Datadog's query service and returns matching results.
       #
       # The searcher is horizontally scalable - you can increase `replicaCount` to handle more concurrent searches.
       # Resource requirements for searchers are highly workload-dependent and should be determined empirically.
       # Key factors that impact searcher performance include:
       # - Query complexity (for example, number of terms, use of wildcards or regex)
       # - Query concurrency (number of simultaneous searches)
       # - Amount of data scanned per query
       # - Data access patterns (cache hit rates)
       #
       # Memory is particularly important for searchers as they cache frequently accessed index data in memory.
       searcher:
         replicaCount: 2
         podSize: xlarge
  7. Helm チャートをインストールまたはアップグレードします。

    helm upgrade --install <RELEASE_NAME> datadog/cloudprem \
      -n <NAMESPACE_NAME> \
      -f datadog-values.yaml
    

検証

デプロイステータスの確認

すべての BYOC Logs コンポーネントが実行されていることを確認します。

kubectl get pods -n <NAMESPACE_NAME>
kubectl get ingress -n <NAMESPACE_NAME>
kubectl get services -n <NAMESPACE_NAME>

アンインストール

BYOC Logs をアンインストールするには、次のコマンドを実行します。

helm uninstall <RELEASE_NAME>

次のステップ

Datadog Agent を使用したログ取り込みのセットアップ - Datadog Agent を構成してログを BYOC Logs に送信します