How to add JVM Arguments and environment variables for Bitbucket Data Center in Kubernetes
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
This page describes how to add additional JVM arguments and environment variables in the Kubernetes environment.
Environment
Kubernetes
Helm Charts
Solution
How to add JVM Arguments for Bitbucket
To configure the JVM properties in Kubernetes, use the additionalJvmArgs
section from the values.yaml
file.
1
2
3
4
5
6
# -- Specifies a list of additional arguments that can be passed to the Bitbucket JVM, e.g.
# system properties.
#
additionalJvmArgs:
- --add-opens java.base/java.lang.reflect=ALL-UNNAMED
- --add-opens java.base/java.io=ALL-UNNAMED
After making the changes, run the below for the changes to take effect:
1
helm upgrade bitbucket atlassian-data-center/bitbucket --namespace bitbucket -f values.yaml
Once done, verify what settings are in place by checking the "ps -ef | grep java
" command on the virtual server where the bitbucket process is running:
1
2003 8149 8137 78 13:11 ? 00:02:55 /opt/java/openjdk/bin/java -classpath /opt/atlassian/bitbucket/app -Dcluster.node.name=bitbucket-0 -Datlassian.standalone=BITBUCKET -Dbitbucket.home=/var/atlassian/application-data/bitbucket -Dbitbucket.install=/opt/atlassian/bitbucket -Dcom.sun.jndi.ldap.connect.pool.timeout=300000 -Xms512m -Xmx1g -XX:+UseG1GC -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.io.tmpdir=/var/atlassian/application-data/bitbucket/tmp -Djava.library.path=/opt/atlassian/bitbucket/lib/native;/var/atlassian/application-data/bitbucket/lib/native -XX:+IgnoreUnrecognizedVMOptions --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED -XX:ActiveProcessorCount=2 com.atlassian.bitbucket.internal.launcher.BitbucketServerLauncher start --logging.console=true
Notice the part "--add-opens java.base/java.lang.reflect=ALL-UNNAMED"
added to the JVM arguments for Bitbucket.
How to add additional ports for Bitbucket
For example, you're trying to create an application tunnel between Bitbucket and Jira Cloud following the steps in this document: How to create an Application tunnel link between Bitbucket Datacenter and Jira Cloud and as per Step 2 of the document, where it says to
"Add an HTTP connector and upstream port", you need to have the below in the bitbucket.properties
file:
1
2
server.additional-connector.1.port=8081
plugin.secure.tunnel.upstream.port=8081
For this, you need to add the below in the values.yaml
file:
1
2
3
4
5
6
7
8
9
# -- Defines any additional environment variables to be passed to the Bitbucket
# container. See https://hub.docker.com/r/atlassian/bitbucket for
# supported variables.
#
additionalEnvironmentVariables:
- name: SERVER_ADDITIONAL_CONNECTOR_1_PORT
value: "8081"
- name: PLUGIN_SECURE_TUNNEL_UPSTREAM_PORT
value: "8081"
⚠️ Be careful to add this in the Bitbucket section and not the Mesh one.
After making the changes, run the below for the changes to take effect:
1
helm upgrade bitbucket atlassian-data-center/bitbucket --namespace bitbucket -f values.yaml
Helpful Reference docs
How to convert the settings from the
bitbucket.properties
file to environment variables is explained on the page Binding From Environment Variables.The same is mentioned together with some examples on the KB How to migrate Bitbucket Server and Data Center to Docker container.
Was this helpful?