Upgrading Nexus Repository in a Kubernetes Environment
This topic provides step-by-step instructions for upgrading your resilient or highly available (HA) Sonatype Nexus Repository deployment in a Kubernetes environment.
Note
Only available in Sonatype Nexus Repository Pro. Interested in a free trial? Start here.
Optional Alternative if Using Zero-Downtime (Rolling) Upgrades
If you are doing a zero-downtime upgrade (only available when upgrading to 3.72.0+), you can also use kubectl set image/undo rollout
for rollouts and rollbacks. See the Kubernetes documentation on rolling back a deployment.
(Step 1 is only required if not doing a rolling/zero-downtime upgrade, which is not available until upgrading to 3.72.0+)
Scale
replicas
to "0" using the command below:kubectl get statefulsets <stateful-set-name> kubectl scale statefulsets <stateful-set-name> --replicas=0
Update the statefulsets.yaml with the Sonatype Nexus Repository version to wish you which to upgrade. Look for a line like the following:
image: sonatype/nexus3:<version>
(Step 3 is only required if not doing a rolling/zero-downtime upgrade)
Ensure the statefulset.yaml is set to include the desired number of
replicas
.Apply the updated statefulset.yaml:
kubectl apply -f <updated-stateful-set-file>
This section covers upgrading Sonatype Nexus Repository using a Helm chart.
Updating to Helm Chart with Shared Logging
From Nexus Repository release 3.68.0 forward, the Helm chart uses a shared logging location. Before updating to a Nexus Repository 3.68.0+ Helm chart from an earlier version, download a support zip for each of your Nexus Repository instances.
(Step 1 is only required if not doing a rolling/zero-downtime upgrade, which is not available until upgrading to 3.72.0+)
Scale
replicas
to 0 using the command below:kubectl get statefulsets -n <namespace> kubectl scale statefulsets <stateful-set-name> --replicas=0 -n <namespace>
Update your custom values.yaml to the desired Sonatype Nexus Repository version. Look for a line like the following:
container: image: repository: sonatype/nexus3 nexusTag: <version-number>
Use an upgrade command like the ones below:
If you installed from Sonatype Helm index:
helm upgrade <release-name> sonatype/nxrm-ha
If you installed directly from the Git repository:
helm upgrade <release-name> nxrm3-ha-repository/nxrm-ha-helm -f values.yaml
(Step 4 is only required if not doing a rolling/zero-downtime upgrade)
Scale replicas to your desired number of replicas using a command like the one below:
kubectl get statefulsets -n <namespace> kubectl scale statefulsets <stateful-set-name> --replicas=<number of replicas> -n <namespace>
Before release 3.62.0, we offered separate Helm charts for AWS and Azure environments. As of release 3.62.0, we now offer a single HA Helm chart (GitHub, ArtifactHub) that can be used in AWS, Azure, or on-premises deployments.
If you were previously using one of the separate Helm charts and will now be using the combined one, follow these steps:
Uninstall the old Helm chart using a command like the following where
<release-name>
is the string you provided when first installing the chart:helm uninstall <release-name>
Update the values.yaml for the new combined HA Helm Chart (GitHub, ArtifactHub). with appropriate settings for your deployment. Note that you will need to customize a new values.yaml with appropriate information for your deployment; you will not be able to use the same custom values.yaml that you used with the individual AWS/Azure Helm charts.
Install the new Helm chart using a command like the following:
helm install <release-name> --debug
Upgrading in a Non-Kubernetes Environment
If you are not using Kubernetes, you will need to stop all Sonatype Nexus Repository instances before upgrading any individual instance.
Then, you can upgrade each instance following the instructions provided in Upgrading a Standalone Instance.