Google Cloud introduced Service Directory, a fully managed cloud service conceived as a single place to publish, discover, and connect services regardless of their environment
Service Directory use the following components:
- Endpoint: This component handles client requests and it is composed of an IP address and a port. The endpoint can be a VM, a container, load balancer, or any entity that is able to respond to a client request. Endpoints can have additional metadata in the form of key-value pairs. However, their scope is within the service.
- Service: This component is a group of endpoints that provide a set of behaviors. Clients can look up a service by its name (throughout the HTTP/gRPC protocol) and then connect to the endpoint that handles the request. Services live within namespaces.
- Namespace: This component groups services for better management. It stays in a GCP region and a GCP project, and must have a unique name within them. Even though the namespace is a regional service, the services that are inside the namespace can be anywhere and can be queried from anywhere.
Clients that want to discover, publish, and manage services inside Service Directory can use the following methods to interact with its API:
- Client Libraries: This method provides the Software Development Kit (SDK) of the main programming languages. This will provide programmatic access to the Service Directory API.
- REST: This method allows clients to interact with the Service Directory API using the HTTP protocol.
- RPC: This method allows clients to interact with the Service Directory API using the gRPC protocol.
ADD ENDPOINT button to create a new endpoint inside the frontend service:
Now, suppose you want to resolve endpoints using DNS for private IP addresses within your VPC. For this, you need to create a Cloud DNS private zone and bind it to the Service Directory namespace.
Register a new service privatefrontend for this demonstration:
Configure a Cloud DNS private zone and link it to the Service Directory namespace:
Now , you can ping from vm in the VPC:
In addition to DNS support, Service Directory offers HTTP and gRPC APIs to query and resolve services.