Bitbucket Data Center Base URL points to Ingress controller instead of the External Load Balancer in Kubernetes Cluster
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
In the Bitbucket Data Center hosted on Kubernetes cluster setup, including the External load balancer, the Bitbucket Base URL points to the Ingress controller instead of the External Load Balancer.
Environment
Tested on Bitbucket Data Center 8.9.9
Applies to Bitbucket Data Center 8.x
Kubernetes Cluster
Diagnosis
Check the
host
parameter defined invalues.yaml
file under the "Ingress"
section if it belongs to the Ingress Controller hostname or External Load Balancer Hostname.Check External Load Balancer configuration file parameters whether they are defined correctly.
Here's a flow diagram of the user request from an External Load Balancer up until the Kubernetes pod:

In the above diagram, we can see that Client is sending a request to External Load Balancer and External Load Balancer further sending a request to Ingress Controller. Ingress controller internally communicates with Kubernetes service and Kubernetes pod.
Cause
This issue generally occurs when the following parameters are not defined or they are defined but not correctly while following the Data Center on K8s Installation Article:
host
parameter under the Ingress category invalues.yaml
file. This parameter needs to be set to External Load Balancer hostname:1 2 3 4 5 6 7 8 9
ingress: create: true #1. Setting true here will create an Ingress resource nginx: true #2. If using the ingress-nginx controller set this property to true maxBodySize: 250m host: <dns_host_name> #2. Hosts can be precise matches (for example “foo.bar.com”) or a wildcard (for example “*.foo.com”). path: "/" annotations: cert-manager.io/issuer: <certificate_issuer> https: true tlsSecretName: <tls_certificate_name>
External load balancer configuration file should have the "
proxy_set_header Host $host
;" parameter set:1 2 3 4 5 6 7 8 9 10 11 12
## Example of Nginx Load Balancer: location / { allow all; proxy_pass https://<target_host_name>; proxy_set_header Host $host; proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; client_max_body_size 10M; }
Solution
By setting the host
parameter under values.yaml
to External Load Balancer hostname and defining the "proxy_set_header Host $host;"
parameter in the External Load Balancer configuration file should resolve this issue.
a. Changing the above parameters after the pod is already running, needs redeployment of the pod as well as a restart of the External Load Balancer.
b. The parameter "proxy_set_header Host $host;" lets the Ingress controller know which host it is and the ingress controller will look for a matching host from the Ingress object.
Was this helpful?