You can choose to automatically register your external passthrough Network Load Balancer service with Service Directory when you create an external passthrough Network Load Balancer. This enables client applications to use Service Directory through HTTP, gRPC, or DNS to resolve the address of the external passthrough Network Load Balancer service and connect to it directly.
Register an external passthrough Network Load Balancer with Service Directory
To register an external passthrough Network Load Balancer, run the gcloud compute forwarding-rules
create
command
and
set the service-directory-registration
flag:
gcloud beta compute forwarding-rules create FORWARDING_RULE_NAME \ --region= REGION \ --load-balancing-scheme=EXTERNAL \ --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 -
RESERVED_IP_ADDRESS
: the IP address that the forwarding rule serves -
PROTOCOL_TYPE
: the IP protocol that the rule is to serve -
PORT_NUMBER
: a list of comma-separated ports -
BACKEND_SERVICE_NAME
: the 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. This service must be 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
- To learn more about Service Directory, see Service Directory overview .
- To learn about limitations of Service Directory integration with external passthrough Network Load Balancer and how to verify the endpoint, see Register an external passthrough Network Load Balancer .