ご利用の環境内で Service Directory を使用する 6 つのメリット
![https://storage.googleapis.com/gweb-cloudblog-publish/images/Service_Directory.max-2500x2500.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/Service_Directory.max-2500x2500.jpg)
Google Cloud Japan Team
※この投稿は米国時間 2023 年 3 月 14 日に、Google Cloud blog に投稿されたものの抄訳です。
Service Directory についてご興味がおありですか?この投稿では、Service Directory とは何か、また、Google Cloud 環境で Service Directory を使用すべき理由を説明します。
Service Directory は、サービスの公開、検索、接続を 1 か所でまとめて行えるマネージド サービスです。
Service Directory にはさまざまな利点がありますが、ここでは特に私がおすすめする 6 つのメリットを紹介します。
1. 一か所にまとまっている
Service Directory を使えば、ご利用のサービスを一か所でまとめて簡単に表示、管理できます。具体的には、サービスにすばやくアクセスし、(名前、アノテーション、Key-Value ペア)を使ってサービスデータを拡張したり、Traffic Director を使ってトラフィック管理ポリシーを適用したりできます。また、DNS、HTTP、gRPC を使ってのクエリに対応しているので、複数の方法でサービスとやりとりすることが可能です。
2. 複数の環境をサポート
Service Directory は、Google サービスはもちろん、サードパーティや、オンプレミス、マルチクラウドのサービスまで、複数の環境に対応しています。そのため、管理者はこれらのサービスをトラッキングするために複数のアプリケーションを使用する必要がなく、煩わしさを回避できます。
![https://storage.googleapis.com/gweb-cloudblog-publish/original_images/1-multi_2.gif](https://storage.googleapis.com/gweb-cloudblog-publish/original_images/1-multi_2.gif)
![https://storage.googleapis.com/gweb-cloudblog-publish/original_images/1-multi_2.gif](https://storage.googleapis.com/gweb-cloudblog-publish/original_images/1-multi_2.gif)
3. Traffic Director とのインテグレーション
Traffic Director とは、アプリケーション ネットワーキングを対象とするマネージド コントロール プレーンであり、Service Directory と統合できます。いったん Traffic Director サービスを構成すると、Service Directory に対して登録済みサービスとその到達方法についてクエリを実行できるようになります。簡単にサービス バインディングを行って、Traffic Director で登録済みのサービスに対してトラフィックをルーティングしたり、ポリシーを適用したりできます。
Service Directory と Traffic Director を統合すれば、Compute Engine、Google Kubernetes Engine、ロードバランサ、マルチクラウド、オンプレミスなど、サービスの実行環境ごとに複雑な構成を行う必要がなくなります。詳しくは、ブログ投稿 トラフィック管理の標準化: Service Directory と Traffic Directorをご覧ください。
構成方法は簡単です。
Service Directory にサービスを登録する。
Traffic Director バックエンド サービスにサービスをバインドする。
インテグレーションの設定方法について詳しくは、Service Directory とのインテグレーションの設定に関するドキュメントをご覧ください。
![https://storage.googleapis.com/gweb-cloudblog-publish/images/2-service-discovery-td.max-1200x1200.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/2-service-discovery-td.max-1200x1200.jpg)
![https://storage.googleapis.com/gweb-cloudblog-publish/images/2-service-discovery-td.max-1200x1200.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/2-service-discovery-td.max-1200x1200.jpg)
4. Cloud DNS とのインテグレーション
Cloud DNS は、Google Cloud が提供するスケーラビリティに優れたマネージド DNS サービスです。Cloud DNS を Service Directory と統合することで、Service Directory 名前空間に対して DNS 名を使ってクエリを実行することができます。Service Directory 名前空間内でサービス レコードの更新やサービスの追加を行うと、その情報が自動的に Cloud DNS に反映されます。
![https://storage.googleapis.com/gweb-cloudblog-publish/images/3-service-directory-05.max-2000x2000.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/3-service-directory-05.max-2000x2000.jpg)
![https://storage.googleapis.com/gweb-cloudblog-publish/images/3-service-directory-05.max-2000x2000.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/3-service-directory-05.max-2000x2000.jpg)
この構成には、以下が必要です。
既存の Service Directory 名前空間がある
Cloud DNS ゾーンを作成する
[Service Directory の名前空間を使用する] というオプションを選択する
インテグレーションの設定方法について詳しくは、Service Directory の DNS ゾーンの構成に関するドキュメントをご覧ください。
5. プライベート ネットワーク アクセスとのインテグレーション
プライベート ネットワーク アクセスを使用すれば、インターネットを使わずに、Google Cloud プロダクトからお客様のプライベート ネットワーク内の HTTP(S) エンドポイントにアクセスすることができます。たとえば、プライベート ネットワーク アクセスの接続を使用して、Dialogflow から VM サーバーに通信する、といったことができるようになります。
![https://storage.googleapis.com/gweb-cloudblog-publish/images/4-pna.max-2000x2000.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/4-pna.max-2000x2000.jpg)
![https://storage.googleapis.com/gweb-cloudblog-publish/images/4-pna.max-2000x2000.jpg](https://storage.googleapis.com/gweb-cloudblog-publish/images/4-pna.max-2000x2000.jpg)
この構成には、以下が必要です。
VPC
Service Directory プロジェクト
プライベート ネットワーク アクセスを呼び出すように構成した Google Cloud サービス プロジェクト
この設定方法について詳しくは、プライベート ネットワーク アクセスの構成および Service Directory を使用したプライベート ネットワーク アクセスの各ドキュメントをご覧ください。
6. サービスの登録が簡単
Service Directory は、コンソールや、gcloud コマンド、自動登録など、さまざまな方法で有効にすることができます。Service Directory は、上述のサービスに加え、ロードバランサや Google Kubernetes Engine などの Google Cloud の各種サービスとも統合可能です。統合することで、ビューを活用して各種サービスを管理できるようになります。
ハンズオンラボのデモ
Skills Boost プラットフォームで公開されている Service Directory: Qwik Start というハンズオンラボで、サービスのデモをご覧になれます。このラボでは、仮想環境でいくつかのタスクを実行することができます。実行できるタスクは以下のとおりです。
Service Directory の名前空間、サービス、エンドポイントを構成する
Service Directory の DNS ゾーンを構成する
Service Directory で Cloud Logging を使用する
![https://storage.googleapis.com/gweb-cloudblog-publish/original_images/5-qwiklabs2.gif](https://storage.googleapis.com/gweb-cloudblog-publish/original_images/5-qwiklabs2.gif)
![https://storage.googleapis.com/gweb-cloudblog-publish/original_images/5-qwiklabs2.gif](https://storage.googleapis.com/gweb-cloudblog-publish/original_images/5-qwiklabs2.gif)
Service Directory を有効にして使用する方法について詳しくは、以下をご覧ください。
Skills Boost: Service Directory: Qwik Start
ドキュメント: Service Directory
ご質問やご不明な点、ご意見は、Linkedin 経由で筆者までお送りください。
- Google、デベロッパー リレーションズ エンジニア Ammett Williams