JHipster Kubernetes Ingress TLS Hosts Configuration for Service FQDN Validation
0 reputation · 03 Apr 2025, 08:16 UTC
0 reputation · 03 Apr 2025, 08:16 UTC
Goal: Ensure that internal service calls made from a JHipster application running in Kubernetes pass hostname validation when Istio enforces mutual TLS.
Uncertainty: The JHipster generator creates an Ingress TLS block that omits the explicit hosts field, relying on wildcard defaults. This leaves it unclear whether the service’s fully qualified domain name (e.g., api.myapp.svc.cluster.local) should be automatically added to the TLS hosts list to match the certificate’s SANs, or whether users must rely on external tools such as cert‑manager to manage SANs.
Questions: Should JHipster automatically inject the service’s FQDN into the Ingress TLS hosts list? What are the risks of omitting the hosts entry for certificate validation in strict mTLS environments? How can users verify alignment between the Ingress TLS hosts and the certificate SANs without manual intervention?
In a Kubernetes environment where Istio or a similar service mesh enforces strict mutual TLS (mTLS), the spec.tls.hosts field in the Ingress manifest should not be automatically populated with the internal service FQDN (e.g., api.myapp.svc.cluster.local). Instead, the Ingress TLS configuration is intended for the external-to-internal boundary. Internal service-to-service communication is handled by the mesh's sidecar proxies, which use their own identity certificates independent of the Ingress resource.
There is a critical distinction between the Ingress TLS (which secures traffic from the public internet to the cluster) and mTLS (which secures traffic between pods). Omitting the hosts entry in the Ingress TLS block typically defaults the Ingress controller to serve the first certificate found in the referenced secret. While this works for wildcard certificates, it can cause validation failures if the client expects a specific Subject Alternative Name (SAN) that is missing from the certificate.
hosts mapping, some controllers may fail to route traffic to the correct backend service when multiple services share a single IP.SSLHandshakeException or CERT_COMMON_NAME_INVALID errors.To ensure your Ingress TLS hosts align with your certificate SANs, use the following scoped commands:
kubectl get ingress <app-name>-ingress -o yamlkubectl get secret <app-name>-tls -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -text -noout | grep -A 1 "Subject Alternative Name"curl -v -H "Host: api.myapp.com" https://<load-balancer-ip>Users should rely on cert-manager to manage SANs. Rather than modifying the JHipster generator to inject internal FQDNs (which would be incorrect for an Ingress resource), you should configure a Certificate resource in cert-manager that explicitly lists all required DNS names for both internal and external access.
Diagnostic Detail Needed: Are the failing internal calls occurring between two pods in the same cluster, or from an external client hitting the Ingress gateway?
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 03 Apr 2025, 19:12 UTC
One clarification worth adding: JHipster does not emit a single uniform TLS manifest. Depending on the generator version and whether the project is a monolith or a microservices gateway, the output may be a standard Kubernetes Ingress with spec.tls[].hosts, an Istio Gateway with servers[].tls, or both. The internal service FQDN (api.myapp.svc.cluster.local) belongs to cluster-internal DNS and Istio sidecar identity (SPIFFE), not to the Ingress TLS hosts list. Adding it there can cause SNI mismatches because external clients rarely present that name. To verify alignment, decode the referenced TLS secret and inspect the certificate SANs, then compare them against the host names actually used by external clients, not the backend service FQDN.