Traffic Director とそのクライアント(Envoy プロキシまたはプロキシレス gRPC ライブラリ)は、オープンソースの xDS API を使用して情報を交換します。Traffic Director を構成すると(たとえば、転送ルールやバックエンド サービスなどのリソースを使用している場合)、Traffic Director は、これらのリソースを xDS 構成に変換してクライアントと共有します。
xDS バージョンのサポート
xDS はバージョニングされた API で、Traffic Director は xDS v2 と xDS v3 をサポートしています。次の表に、クライアント タイプ別の xDS API のサポート状況を示します。
xDS v2 | xDS v3 | |
---|---|---|
Envoy | 一般提供サポート: Envoy バージョン 1.9.1 ~1.16.2 |
プレビュー サポート: Envoy バージョン 1.15.0 以降 |
プロキシレス gRPC | 一般提供サポート: gRPC バージョン 1.30.0 以上 |
現時点ではサポートされていません |
xDS v2 のサポートは、Envoy の最新バージョンでは終了しています。Envoy コミュニティでは、2020 年末で xDS v2 のサポートを終了する予定です。2021 年第 1 四半期以降、Envoy の新しいバージョンでは、xDS v3 のみサポートされます。詳細については、Envoy のサポート API バージョンをご覧ください。
xDS v3 のプレビュー
Traffic Director は、Envoy を手動でデプロイする際、xDS v3 API のプレビューをサポートしています。このプレビュー サポートをテストするには、Compute Engine または Google Kubernetes Engine の「手動 Envoy セットアップ ガイド」をご覧ください。設定ガイドには、次の変更を加える必要があります。
サービス アカウントに対する新しい Traffic Director の権限
サービス アカウントには、trafficdirector.configurations.get
権限と trafficdirector.endpointmetrics.report
権限が必要です。IAM ロール trafficdirector.client
を使用して、両方の権限をラップできます。compute.forwardingRules.get
権限は不要になりました。
この IAM ロールをサービス アカウントに追加するには、次のコマンドを使用します。
gcloud projects add-iam-policy-binding ${PROJECT} \ --member serviceAccount:${SERVICE_ACCOUNT_EMAIL} \ --role roles/trafficdirector.client
Compute Engine のリファレンス パッケージの更新
Compute Engine 設定ガイドを使用している場合は、インスタンス テンプレートの作成時に、設定ガイドで提供されているコードサンプルではなく、次のコードサンプルを使用してください。
gcloud compute instance-templates create td-vm-template \ --scopes=https://www.googleapis.com/auth/cloud-platform \ --tags=http-td-tag,http-server,https-server \ --image-family=debian-9 \ --image-project=debian-cloud \ --metadata=startup-script="#! /bin/bash # Add a system user to run Envoy binaries. Login is disabled for this user sudo adduser --system --disabled-login envoy # Download and extract the Traffic Director tar.gz file sudo wget -P /home/envoy https://storage.googleapis.com/traffic-director/traffic-director-xdsv3.tar.gz sudo tar -xzf /home/envoy/traffic-director-xdsv3.tar.gz -C /home/envoy sudo cat << END > /home/envoy/traffic-director-xdsv3/sidecar.env ENVOY_USER=envoy # Exclude the proxy user from redirection so that traffic doesn't loop back # to the proxy EXCLUDE_ENVOY_USER_FROM_INTERCEPT='true' # Intercept all traffic by default SERVICE_CIDR='*' GCP_PROJECT_NUMBER=project number VPC_NETWORK_NAME=network name ENVOY_IMAGE='envoyproxy/envoy:v1.15.0' ENVOY_PORT='15001' ENVOY_ADMIN_PORT='15000' LOG_DIR='/var/log/envoy/' LOG_LEVEL='info' XDS_SERVER_CERT='/etc/ssl/certs/ca-certificates.crt' END sudo apt-get update -y sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - sudo add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/debian stretch stable' -y sudo apt-get update -y sudo apt-get install docker-ce apache2 -y sudo service apache2 restart echo '<!doctype html><html><body><h1>'`/bin/hostname`'</h1></body></html>' | sudo tee /var/www/html/index.html cd /home/envoy/traffic-director-xdsv3 sudo ./run.sh start"
Google Kubernetes Engine のリファレンス パッケージの更新
Google Kubernetes Engine 設定ガイドを使用している場合は、Google Kubernetes Engine / Kubernetes Pod にサイドカー プロキシを挿入するの手順で、次の行を置き換えます。
旧:
wget -q -O - \ https://storage.googleapis.com/traffic-director/demo/trafficdirector_client_sample.yaml \ | kubectl apply -f -
新:
wget -q -O - https://storage.googleapis.com/traffic-director/demo/trafficdirector_client_sample_xdsv3.yaml sed -i "s/PROJECT_NUMBER/project number/g" trafficdirector_client_sample_xdsv3.yaml sed -i "s/NETWORK_NAME/network name/g" trafficdirector_client_sample_xdsv3.yaml kubectl apply -f trafficdirector_client_sample_xdsv3.yaml