Skip to content

Understanding “502 BAD GATEWAY” Error When Using HTTPS with Sonatype Nexus Private Registry on Kubernetes Ingress

The challenge arises when attempting to access a Docker private registry set up through the Sonatype Nexus UI, configured via an ingress-nginx (Kubernetes), while using SSL encryption. Here’s what you need to know:

Problem Encountered

Configuring your repository with HTTPS on port 8080 led inaccessibility and triggered a 502 BAD GATEWAY error from nginx, whereas an unsecured (HTTP) configuration works as intended. This suggests that ingress-nginx isn’t forwarding SSL properly to Nexus without additional configurations:

  1. Accessible when using HTTP on port 8080 but not with secured connections pointing back at the registry over TCP/443, even though TLS is enabled in your setup (as observed via socat tool).
  2. SSL termination typically happens within nginx itself if unconfigured for passthrough; thus without further configuration adjustments or specific ingress controller flags (--enable-ssl-pasthrough), the connection will not reach Nexus over HTTPS end to end, resulting in an error state whereby traffic remains decrypted and potentially visible on its path from nginx back into your registry.
  3. The annotations nginx.ingress.kubernetes.io/ssl-redirect: "true" must be added alongside ensuring the ingress controller was initiated with --enable-ssl-passthrough for traffic to reach Nexus over HTTPS without SSL termination happening within nginx itself, thus maintaining end-to-end encryption that aligns security expectations.
  4. Organizational practices on using secure channels can vary and depend heavily upon your infrastructure’s unique requirements as well as governance decisions regarding where the most critical points of trust are maintained (either at proxy level or registry access).

Best Practices for Nexus Repository Setup with Kubernetes Ingress

For those seeking guidance on deploying a secure private repository, consider these approaches:

In summary: The choice between HTTP and the more secure but technically nuanced setup of an actual passthrough-enabled encryption flow with ingress on port 8080 (or similar, dependent upon your security architecture) should be made by assessing specific deployment needs within context—understanding where trust boundaries are most critical.

When configuring TLS for private registry and network traffic involving sensitive data:


Previous Post
Why Set internalTrafficPolicy Local in Kubernet
Next Post
Measuring Image Pull Latency in Kubernetes Cluster