How to install Nexus Pro instance using Sonatype helm3 chart

 

Nexus Repository Manager can be deployed in kubernetes cluster using various methods

1. Using YAML files 

2. Using Helm Charts

3. Using Openshift Operator.


This article explains installing Nexus instance with pro license using Sonatype helm3 charts.

 

PreRequisites:

  • Kubernetes 1.19+
  • kubectl
  • Helm 3
  • A Nexus Repository Pro license (base64 encoded)

Base64 encoded data of Nexus Pro license file named in this example as nx-license.lic

$ base64 nx-license.lic
cylwwtYx6Fjh7o4k34Ih3KM.....
  • Preferably Separate namespace for Nexus deployment. This example uses namespace name, nexus
$ kubectl create namespace nexus
namespace/nexus created

 

Deploying Nexus Repo

  • Install Sonatype Helm3 charts
$ helm repo add sonatype https://sonatype.github.io/helm3-charts/
"sonatype" has been added to your repositories
  • Create a local myvalues.yaml file overriding with nexus license details. Please note down correct indentation in the example yaml file below. 
nexus:
env:
# minimum recommended memory settings for a small, person instance from
# https://help.sonatype.com/repomanager3/product-information/system-requirements
- name: INSTALL4J_ADD_VM_PARAMS
value: |-
-Xms2703M -Xmx2703M
-XX:MaxDirectMemorySize=2703M
-XX:+UnlockExperimentalVMOptions -XX:ActiveProcessorCount=4
-XX:+UseCGroupMemoryLimitForHeap
-Djava.util.prefs.userRoot=/nexus-data/javaprefs
-Dnexus.licenseFile=/etc/nexus-license/license.lic
- name: NEXUS_SECURITY_RANDOMPASSWORD
value: "true"
# # To use an additional secret, set enable to true and add data
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
hostPath: /
hostRepo: nx340.minikube.mydomain
secret:
enabled: true
mountPath: /etc/nexus-license/
readOnly: true
data:
license.lic : 'cylwwtYx6Fjh7o4k34Ih3KMhWlu1TvWP...'
  • Deploy nexus instance using helm
$ helm install nx340 -n nexus -f myvalues.yaml sonatype/nexus-repository-manager
coalesce.go:223: warning: destination for nexus-repository-manager.secret.data is a table. Ignoring non-table value ([])
NAME: nx340
LAST DEPLOYED: Tue Jul 12 13:05:40 2022
NAMESPACE: nexus
STATUS: deployed
REVISION: 1
NOTES:
1. Your ingresses are available here:
http://nx340.minikube.mydomain/
  • Obtain the admin user password from the deployed nexus pod.
$ kubectl get pods -n nexus
NAME READY STATUS RESTARTS AGE
nx340-nexus-repository-manager-55bd6d98b6-xlzv5 1/1 Running 0 5m27s

$ kubectl exec -it -n nexus nx340-nexus-repository-manager-55bd6d98b6-xlzv5 -- cat /nexus-data/admin.password
722639fa-d45a-465e-853f-e0e9faf60eb6
  • Access Nexus UI using the configured Ingress URL and login as admin using password obtained in previous step. Complete the nexus setup. 

nx340-login.png

 

 

We highly recommend to use external database for container environment.

 

Below arguments can be added for connecting to a postgresql hostname postgresql, database named nexusdb, as user nexus with password nexus123. Modify the myvalues.yaml with your local values as below for configuring with external database.

 

    env:
     - name: INSTALL4J_ADD_VM_PARAMS
       value: >-
         -Xms2703m -Xmx2703m
         -Dnexus.licenseFile=/etc/secret-volume/nx-license.lic
          -Djava.util.prefs.userRoot=/nexus-data/javaprefs
          -Dnexus.datastore.enabled=true
         -Dnexus.datastore.nexus.jdbcUrl=jdbc:postgresql://postgresql-host:5432/nexusdb

         -Dnexus.datastore.nexus.username=nexus
         -Dnexus.datastore.nexus.password=nexus123
          -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
         -XX:ActiveProcessorCount=4


Attached example myvalues.yaml file that can be used as reference.


Upgrading Nexus deployment

Below example upgrades nexus 3.39.0 version deployed on nx3 namespace to latest nexus 3.40.1.

NOTE: Please follow all the steps explained in our document link prior to upgrading nexus deployment, including backing up nexus database.

  • Check current nexus deployment version
$ helm list -n nx3
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nexus3 nx3 1 2022-07-14 14:56:26.283526 +1000 AEST deployed nexus-repository-manager-39.0.0 3.39.0
  • Check current helm chart version (Below example helm repo has chart version 39.0.1)
$ helm search repo sonatype/nexus-repository-manager --versions
NAME CHART VERSION APP VERSION DESCRIPTION
sonatype/nexus-repository-manager 39.0.1 3.39.0 Sonatype Nexus Repository Manager - Universal B...
sonatype/nexus-repository-manager 39.0.0 3.39.0 Sonatype Nexus Repository Manager - Universal B...
  • Update helm repo to get latest versions
$ helm repo update sonatype
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "sonatype" chart repository
Update Complete. ⎈Happy Helming!⎈
  • Confirm new chart version is updated
$ helm search repo sonatype/nexus-repository-manager --versions
NAME CHART VERSION APP VERSION DESCRIPTION
sonatype/nexus-repository-manager 40.1.0 3.40.1 Sonatype Nexus Repository Manager - Universal B...
sonatype/nexus-repository-manager 40.0.0 3.40.0 Sonatype Nexus Repository Manager - Universal B...
sonatype/nexus-repository-manager 39.0.1 3.39.0 Sonatype Nexus Repository Manager - Universal B...
sonatype/nexus-repository-manager 39.0.0 3.39.0 Sonatype Nexus Repository Manager - Universal B...

  • Upgrade current deployment to latest version
$ helm upgrade nexus3 -n nx3 sonatype/nexus-repository-manager
coalesce.go:223: warning: destination for nexus-repository-manager.secret.data is a table. Ignoring non-table value ([])
Release "nexus3" has been upgraded. Happy Helming!
NAME: nexus3
LAST DEPLOYED: Thu Jul 14 15:06:49 2022
NAMESPACE: nx3
STATUS: deployed
REVISION: 2
NOTES:

1. Your ingresses are available here:
http://nexus3.minikube.mydomain/
  • Confirm nexus deployment is updated
$ helm list -n nx3
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nexus3 nx3 2 2022-07-14 15:06:49.402834 +1000 AEST deployed nexus-repository-manager-40.1.0 3.40.1
  • Login to Nexus UI and confirm that new version is upgraded

nx340.png

 

 

Uninstalling Nexus deployment

  • List current helm deployment
$ helm list -n nexus
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nx340 nexus 1 2022-07-12 13:05:40.422695 +1000 AEST deployed nexus-repository-manager-40.1.0 3.40.1

 

  • Uninstall the helm release. 

Please note, this would remove the persistent volume as well, thus result in data loss.

$ helm uninstall nx340 -n nexus
release "nx340" uninstalled

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.