This page applies to Apigee, but not to Apigee hybrid.
View
Apigee Edge documentation.
This playbook explains how to diagnose and resolve intermittent or
persistent DNS resolution failures, high target connection latency, and
SERVFAIL responses when Apigee connects to
southbound backend targets using private DNS peering or Cloud DNS
forwarding zones.
Symptoms
When Apigee resolves private domain names for southbound target endpoints through Cloud DNS, you might observe the following symptoms:
-
API proxy requests to a backend target configured with a private fully
qualified domain name (FQDN) fail intermittently with an HTTP
503 Service Unavailablestatus code and theTARGET_CONNECT_HOST_NOT_REACHABLEerror reason. -
In an Apigee
Debug session, the
target endpoint step records the following flow variable values:
targetendpoint_main.connectionStatus = FAILED_TO_CONNECTtargetendpoint_main.resolvedAddress = address_not_resolvable
-
DNS lookups from a virtual machine (VM) in the peered
Virtual Private Cloud (VPC) network using the configured private DNS
forwarders intermittently time out across multiple network hops or return
a
SERVFAILresponse, whereas public DNS resolution or direct queries to the final DNS resolver succeed.
Error messages
When private DNS resolution times out or receives a SERVFAIL
response, Apigee returns an HTTP
503 Service Unavailable status code with the following JSON
error payload:
{
"fault": {
"faultstring": "Unable to resolve host api.backend.example.com",
"detail": {
"errorcode": "protocol.http.NoResolvedHost",
"reason": "TARGET_CONNECT_HOST_NOT_REACHABLE"
}
}
}Possible causes
If your target hostname is valid and private DNS peering is already
configured, the protocol.http.NoResolvedHost error typically
occurs when upstream private DNS resolution exceeds the
Apigee DNS lookup timeout window or returns a server
failure. If you haven't verified your hostname syntax or initial DNS peering
setup, see
API
requests fail with TARGET_CONNECT_HOST_NOT_REACHABLE error.
The following table lists the possible cause covered in this playbook:
| Cause | Description | Platform |
|---|---|---|
| Multi-hop private DNS forwarding timeouts and SERVFAIL errors |
DNS queries from Cloud DNS traverse multiple on-premises or
external DNS forwarding hops, causing cumulative resolution timeouts
or intermittent SERVFAIL responses from upstream private
DNS servers.
|
Apigee |
Cause: Multi-hop private DNS forwarding timeouts and SERVFAIL errors
In Apigee, runtime instances are hosted in a Google-managed
tenant VPC network and rely exclusively on
Cloud DNS for DNS resolution. You can't configure custom DNS
servers, modify resolv.conf, or bypass Cloud DNS
directly on Apigee runtime instances.
When Apigee uses
private
DNS peering, Apigee forwards DNS queries for the peered
domain suffix to the producer or Shared VPC host network.
If that network uses a Cloud DNS forwarding zone that routes
queries through a multi-hop chain (for example, from Cloud DNS to
an on-premises DNS forwarder, then to an Active Directory DNS resolver, and
then to an external DNS resolver or secure web gateway), each hop adds
network and processing latency. If the cumulative resolution time exceeds
the Apigee DNS lookup timeout window, or if an upstream
private DNS server in the forwarding chain intermittently returns a
SERVFAIL response, Apigee fails to resolve the
target host and returns the protocol.http.NoResolvedHost error.
Diagnosis
To diagnose multi-hop private DNS resolution timeouts and
SERVFAIL errors, follow these steps:
-
Start a Debug session for the affected API proxy in the Google Cloud console and send a test request that reproduces the HTTP
503 Service Unavailablestatus code.Inspect the target request step in the Debug session results and verify that the flow variables show
targetendpoint_main.connectionStatus = FAILED_TO_CONNECTandtargetendpoint_main.resolvedAddress = address_not_resolvable. -
Identify the peered DNS domains and the target producer VPC network configured for your Apigee organization. Select one of the following options based on your Apigee networking configuration:
VPC peering enabled
If your Apigee organization uses VPC network peering, run the
gcloud services peered-dns-domains listcommand to list the peered DNS domains in your producer VPC network:gcloud services peered-dns-domains list \ --network=VPC_NETWORK_NAME \ --project=PRODUCER_PROJECT_IDReplace the following:
-
VPC_NETWORK_NAME: the name of the VPC network peered with Apigee. -
PRODUCER_PROJECT_ID: the project ID of the Google Cloud project that contains the peered VPC network. In a Shared VPC architecture, specify the host project ID.
The command returns a list of peered DNS domain suffixes similar to the following output:
NAME DNS_SUFFIX backend-internal backend.example.com.
VPC peering not enabled
If your Apigee organization doesn't use VPC network peering, call the
organizations.dnsZones.listmethod to inspect your Apigee DNS peering zones:curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://apigee.googleapis.com/v1/organizations/ORG/dnsZones"Replace the following:
-
ORG: the name of your Apigee organization.
The command returns the configured DNS peering zones, including the
domain,targetProjectId, andtargetNetworkIdfields. -
-
List the Cloud DNS managed zones in the producer or Shared VPC host project to identify which private forwarding zone matches the target hostname domain suffix:
gcloud dns managed-zones list --project=PRODUCER_PROJECT_ID
Inspect the forwarding configuration of the matching zone by running the
gcloud dns managed-zones describecommand:gcloud dns managed-zones describe FORWARDING_ZONE_NAME \ --project=PRODUCER_PROJECT_IDReplace the following:
-
FORWARDING_ZONE_NAME: the name of the private Cloud DNS forwarding zone that matches your target domain. -
PRODUCER_PROJECT_ID: the project ID of the project that hosts the Cloud DNS zone.
Note the private DNS server IP addresses listed under
forwardingConfig.targetNameServersin the output. -
-
From a Compute Engine VM instance connected to the peered VPC network, run
digornslookupagainst each forwarding target IP address to check for resolution timeouts orSERVFAILresponses and inspect the forwarding chain:dig @FORWARDER_IP_ADDRESS TARGET_HOST_FQDN A +stats
Because
SERVFAILerrors and multi-hop timeouts can be intermittent, run the query multiple times against eachFORWARDER_IP_ADDRESS(and against any downstream internal resolvers in the forwarding chain, if reachable) to compare response status and latency:for i in 1 2 3 4 5; do dig @FORWARDER_IP_ADDRESS TARGET_HOST_FQDN A +stats; done
Replace the following:
-
FORWARDER_IP_ADDRESS: the IP address of each private DNS server from thetargetNameServerslist. -
TARGET_HOST_FQDN: the backend target hostname configured in your API proxy, such asapi.backend.example.com.
Inspect the
statusfield in theHEADERsection and theQuery timefield in thedigoutput:;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 48291 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 ;; Query time: 2140 msec ;; SERVER: 10.10.0.53#53(10.10.0.53)
If the output shows
status: SERVFAIL, if the query times out across multiple forwarding hops, or ifQuery timevalues are consistently elevated, the private DNS forwarding path is the cause of theTARGET_CONNECT_HOST_NOT_REACHABLEerrors. -
Resolution
To resolve private DNS resolution timeouts and SERVFAIL errors
caused by multi-hop forwarding, create a specific private
Cloud DNS forwarding
zone for the target domain (TARGET_HOST_FQDN.)
to bypass the failing or slow intermediate DNS hops:
-
If a broad parent or wildcard forwarding zone in your host project (such as
example.com.) routes queries through a multi-hop on-premises DNS chain, create a more specific private Cloud DNS forwarding zone for the target hostname or subdomain (such asapi.backend.example.com.). Configure the specific zone to forward queries directly to the DNS servers that resolve the target domain without additional forwarding hops:gcloud dns managed-zones create SPECIFIC_ZONE_NAME \ --dns-name="TARGET_HOST_FQDN." \ --description="Specific forwarding zone for TARGET_HOST_FQDN" \ --visibility=private \ --networks=VPC_NETWORK_NAME \ --forwarding-targets="DIRECT_DNS_SERVER_IP_1,DIRECT_DNS_SERVER_IP_2" \ --project=PROJECT_IDReplace the following:
-
SPECIFIC_ZONE_NAME: a name for the specific forwarding zone, such asspecific-target-forwarder. -
TARGET_HOST_FQDN: the target hostname (FQDN) or subdomain suffix, such asapi.backend.example.com(include the required trailing dot in--dns-name="TARGET_HOST_FQDN."). -
VPC_NETWORK_NAME: the name or full resource URL of the producer or Shared VPC host network peered with Apigee. -
DIRECT_DNS_SERVER_IP_1,DIRECT_DNS_SERVER_IP_2: a comma-separated list of IP addresses for the DNS resolvers that can resolve the target domain directly. -
PROJECT_ID: the project ID of the service project or Shared VPC host project where you create the zone.
Because Cloud DNS evaluates zones using longest-suffix matching, queries for
TARGET_HOST_FQDN.use the specific forwarding zone, while queries for other domains continue to use the broader wildcard or parent forwarding zone. -
-
Work with your internal DNS and network teams to address the underlying forwarding chain:
-
Investigate intermittent
SERVFAILresponses: Check the health and logs of the configured private DNS servers to identify why a specific DNS server in the forwarding chain is intermittently returningSERVFAILor timing out. -
Reduce forwarding hops with a direct
CNAMErecord: If your private DNS forwarder consistently resolves the target hostname to the same canonical domain name, consider configuring a directCNAMErecord on the first-hop DNS server to reduce the number of intermediate DNS hops.
-
Investigate intermittent
Must gather diagnostic information
If the issue persists after you follow the preceding instructions, gather the following diagnostic information and contact Google Cloud Customer Care:
- Google Cloud project ID and Apigee organization name.
- Affected API proxy name, revision number, and environment name.
- Target hostname (FQDN) and the time window and frequency of the errors.
-
Downloaded
Debug session
file showing the
protocol.http.NoResolvedHosterror and flow variables. -
Output of the
gcloud services peered-dns-domains listandgcloud dns managed-zones describecommands from your producer project. -
Complete output of repeated
dig @FORWARDER_IP_ADDRESS TARGET_HOST_FQDN A +statsqueries run from a Compute Engine VM in the peered VPC network.