How to fix Failed to connect to server: connection refused (HTTP/2) in Kubernetes | DevErrors
How to fix Failed to connect to server: connection refused (HTTP/2) in Kubernetes
KubernetesINTERMEDIATEHIGH
gRPC or HTTP/2 services fail when pods refuse connections on the expected port. Network policies, service configuration, or application setup blocks HTTP/2 traffic.
What this error means
gRPC or HTTP/2 services fail when pods refuse connections on the expected port. Network policies, service configuration, or application setup blocks HTTP/2 traffic. The pod either is not listening or is actively rejecting connections.
Typical symptoms
gRPC client errors: "connection refused"
HTTP/2 frame errors or connection resets
Service shows unhealthy endpoints
kubectl port-forward works but client connections fail
Different behavior between HTTP and HTTP/2 traffic
Intermittent connection refusal depending on load
Application logs show socket binding errors
Common causes
Pod not listening on expected port
Port number mismatch in Service configuration
Network policy blocking gRPC traffic
Application using HTTP/1.1 but service expects HTTP/2
Firewall blocking connection to pod port
Service endpoint port misconfigured
Load balancer protocol mismatch
How to fix "Failed to connect to server: connection refused (HTTP/2)"
1Step 1
First diagnostic step
2Step 2
Second diagnostic step
3Step 3
Third diagnostic step
4Step 4
Fourth diagnostic step
Step 5
Advanced notes
Additional notes and platform-specific considerations.