Internal passthrough Network Load Balancer and Service Directory overview

You can choose to automatically register your internal load balancer service with Service Directory when you create an internal load balancer. This enables client applications to use Service Directory through HTTP, gRPC, or DNS to resolve the address of the internal load balancer service and connect to it directly.

Registering your internal load balancer with Service Directory lets you do the following:

  • Choose custom DNS names to serve the network locations of your internal load balancers as opposed to DNS accessing your internal load balancer only through an internally generated DNS name in the .internal domain.
  • Serve multiple internal load balancers from the same DNS domain name, which is otherwise not possible with the current auto-generated DNS records.
  • Register internal load balancers directly and automatically in Service Directory providing a single repository for all your services in Google Cloud.
  • See standalone services, endpoints, and your internal load balancer endpoints with a single command in the Service Directory API.
  • Apply administrative actions like access control to Service Directory resources at the namespace or service level to encompass both your internal load balancer endpoints as well as other backend services.

Register an internal passthrough Network Load Balancer with Service Directory

To register an internal passthrough Network Load Balancer, run the gcloud compute forwarding-rules create command and set the service-directory-registration flag:

gcloud compute forwarding-rules create FORWARDING_RULE_NAME \
    --region=REGION \
    --load-balancing-scheme=INTERNAL \
    --network=NETWORK_NAME \
    --subnet=SUBNET_NAME \
    --address=RESERVED_IP_ADDRESS \
    --ip-protocol=PROTOCOL_TYPE \
    --ports=PORT_NUMBER \
    --backend-service=BACKEND_SERVICE_NAME \
    --backend-service-region=REGION \
    --service-directory-registration=SD_SERVICE_NAME

Replace the following:

  • FORWARDING_RULE_NAME: a name for the forwarding rule that you want to create
  • REGION: the region to create the forwarding rule in
  • NETWORK_NAME: the network that this forwarding rule applies to
  • SUBNET_NAME: the subnetwork that this forwarding rule applies to
  • RESERVED_IP_ADDRESS: the IP address that the forwarding rule serves
  • PROTOCOL_TYPE: the IP protocol that the rule will serve
  • PORT_NUMBER: a list of comma-separated ports
  • BACKEND_SERVICE_NAME: target backend service that receives the traffic
  • SD_SERVICE_NAME: the fully qualified name of the Service Directory service where you want to register the endpoint. It must live in the same project and region as the forwarding rule being created. For example: projects/PROJECT/locations/REGION/namespaces/NAMESPACE_NAME/services/SERVICE_NAME.

What's next