Integrating Service Directory with GKE: one registry for all your services
PM Service Directory
Try Google Cloud
Start building on Google Cloud with $300 in free credits and 20+ always free products.Free trial
Kubernetes services often form part of a larger deployment. In addition to Google Kubernetes Engine (GKE), you might be running other services on different Google Cloud technologies, as well as services on external clouds and on-premises.
Service Directory is a managed product that allows you to maintain an inventory of all these services in one place, so that services from different platforms can discover and connect to one another. Service Directory offers several core capabilities:
A fully managed registry for your services
Standardized service discovery across all environments, including GKE, other Google Cloud products, and external environments
Service annotations to add metadata to services, and filter services based on metadata
IAM permissions on a logical, per-service level
Access over HTTP, gRPC, and DNS. Service Directory is integrated with Cloud DNS, so services registered to Service Directory will automatically have the corresponding DNS records created in Cloud DNS.
We’re now excited to announce that GKE services can automatically register to Service Directory. In this preview release, GKE services can register and unregister in Service Directory without having to write orchestration code. In Service Directory, services can advertise themselves to other services both within GKE and elsewhere, like in this simple online store:
Populating Service Directory with GKE services
Service Directory registration is available as a GKE Connect feature. In this example, we’ve created a new GKE service called payments as part of the backend of our online store, enabled the Service Directory GKE Connect feature, configured a registration policy, and apply the service YAML below to register to Service Directory:
This payments service is made visible in Service Directory, along with the other services in our deployment.
Onboarding GKE services to Service Directory doesn’t require writing onboarding code to sync a service between GKE and Service Directory—instead, services can be automatically registered and deregistered into Service Directory.
GKE services can be added on a per-service level. The automatic integration supports ClusterIP, Headless, LoadBalancer, and NodePort service types.
Querying Services from Service Directory
You can access services in Service Directory over DNS, HTTP, and gRPC. Service Directory is integrated with Cloud DNS, and can automatically populate DNS records as services are added to it. Clients that already use DNS can continue to do so as they query services in Service Directory.
You can also query services based on their annotations. You can form complex queries based on these annotations to help get specific views on services; for example, you can use Service Directory to find all services that are annotated as ‘experimental’ but that are not annotated with ‘needs-deprecation’.
Since Service Directory is designed for services across multiple environments, both service lookups and annotation-based queries work the same for all services, regardless of the underlying infrastructure the service is built on.
With support for GKE services in Service Directory, now you have one place to keep track of all the services you need to build robust, distributed applications. To start registering GKE services into Service Directory, visit the documentation.