# gRPC error: UNAVAILABLE: DNS resolution failed for service

- **ID:** `api/grpc-unavailable-dns-resolution-failed`
- **Domain:** api
- **Category:** network_error
- **Error Code:** `UNAVAILABLE`
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

gRPC client cannot resolve the service hostname via DNS, often due to transient network issues, misconfigured DNS, or service discovery outages.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC v1.58.0 | active | — | — |
| Envoy 1.28.0 | active | — | — |
| Kubernetes 1.28 | active | — | — |
| CoreDNS 1.11.0 | active | — | — |

## Workarounds

1. **Verify DNS resolution: `nslookup service.example.com` or `dig service.example.com`. If fails, check /etc/resolv.conf and DNS server health.** (90% success)
   ```
   Verify DNS resolution: `nslookup service.example.com` or `dig service.example.com`. If fails, check /etc/resolv.conf and DNS server health.
   ```
2. **Configure gRPC with custom DNS resolver: In Go, use `google.golang.org/grpc/resolver` and set `grpc.WithDefaultServiceConfig('{"loadBalancingConfig": [{"round_robin":{}}]}')`** (80% success)
   ```
   Configure gRPC with custom DNS resolver: In Go, use `google.golang.org/grpc/resolver` and set `grpc.WithDefaultServiceConfig('{"loadBalancingConfig": [{"round_robin":{}}]}')`
   ```
3. **Add retry logic with exponential backoff for transient DNS failures: in gRPC-Go, use `grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor())`** (85% success)
   ```
   Add retry logic with exponential backoff for transient DNS failures: in gRPC-Go, use `grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor())`
   ```

## Dead Ends

- **** — Restarting the client application without fixing DNS configuration or network connectivity (85% fail)
- **** — Assuming the service is down when it's actually a DNS resolution failure on the client side (70% fail)
- **** — Changing gRPC load balancing policy (e.g., round_robin to pick_first) which doesn't affect DNS resolution (60% fail)
