Back to Charts

Nexus

stable/sonatype-nexus/README.md

latest19.4 KB
Original Source

Nexus

This chart has been deprecated and moved to Oteemo Charts

Nexus OSS is a free open source repository manager. It supports a wide range of package formats and it's used by hundreds of tech companies.

Introduction

This chart bootstraps a Nexus OSS deployment on a cluster using Helm. This setup is best configured in GCP since:

There is also the option of using a proxy for Nexus that authenticates Nexus against an external identity provider (only GCP IAM at the moment) which is disabled by default.

Prerequisites

With GCP IAM enabled

All the Prerequisites should be in place, plus:

Testing the Chart

To test the chart:

bash
$ helm install --dry-run --debug ./

To test the chart with your own values:

bash
$ helm install --dry-run --debug -f my_values.yaml ./

Installing the Chart

To install the chart:

bash
$ helm install stable/sonatype-nexus

The above command deploys Nexus on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

The default login is admin/admin123

Uninstalling the Chart

To uninstall/delete the deployment:

bash
$ helm list
NAME           	REVISION	UPDATED                 	STATUS  	CHART      	NAMESPACE
plinking-gopher	1       	Fri Sep  1 13:19:50 2017	DEPLOYED	sonatype-nexus-0.1.0	default
$ helm delete plinking-gopher

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Nexus chart and their default values.

ParameterDescriptionDefault
statefulset.enabledUse statefulset instead of deploymentfalse
replicaCountNumber of Nexus service replicas1
deploymentStrategyDeployment StrategyrollingUpdate
nexus.imageNameNexus imagequay.io/travelaudience/docker-nexus
nexus.imageTagVersion of Nexus3.19.1
nexus.imagePullPolicyNexus image pull policyIfNotPresent
nexus.imagePullSecretSecret to download Nexus image from private registrynil
nexus.envNexus environment variables[{install4jAddVmParams: -Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap}]
nexus.resourcesNexus resource requests and limits{}
nexus.dockerPortPort to access docker5003
nexus.nexusPortInternal port for Nexus service8081
nexus.service.typeService for NexusNodePort
nexus.service.clusterIpSpecific cluster IP when service type is cluster IP. Use None for headless servicenil
nexus.securityContextSecurity Context (for enabling official image use fsGroup: 2000){}
nexus.labelsService labels{}
nexus.podAnnotationsPod Annotations{}
nexus.livenessProbe.initialDelaySecondsLivenessProbe initial delay30
nexus.livenessProbe.periodSecondsSeconds between polls30
nexus.livenessProbe.failureThresholdNumber of attempts before failure6
nexus.livenessProbe.timeoutSecondsTime in seconds after liveness probe times outnil
nexus.livenessProbe.pathPath for LivenessProbe/
nexus.readinessProbe.initialDelaySecondsReadinessProbe initial delay30
nexus.readinessProbe.periodSecondsSeconds between polls30
nexus.readinessProbe.failureThresholdNumber of attempts before failure6
nexus.readinessProbe.timeoutSecondsTime in seconds after readiness probe times outnil
nexus.readinessProbe.pathPath for ReadinessProbe/
nexus.hostAliasesAliases for IPs in /etc/hosts[]
nexusProxy.enabledEnable nexus proxytrue
nexusProxy.svcNameNexus proxy service namenil
nexusProxy.targetPortContainer Port for Nexus proxy8080
nexusProxy.portPort for exposing Nexus8080
nexusProxy.imageNameProxy imagequay.io/travelaudience/docker-nexus-proxy
nexusProxy.imageTagProxy image version2.5.0
nexusProxy.imagePullPolicyProxy image pull policyIfNotPresent
nexusProxy.resourcesProxy resource requests and limits{}
nexusProxy.env.nexusHttpHostNexus url to access Nexusnil
nexusProxy.env.nexusDockerHostContainers url to be used with dockernil
nexusProxy.env.enforceHttpsAllow only https access or notfalse
nexusProxy.env.cloudIamAuthEnabledEnable GCP IAM authentication in Nexus proxyfalse
nexusProxyRoute.enabledSet to true to create route for additional servicefalse
nexusProxyRoute.labelsLabels to be added to proxy route{}
nexusProxyRoute.annotationsAnnotations to be added to proxy route{}
nexusProxyRoute.pathHost name of Route e.g jenkins.example.comnil
persistence.enabledCreate a volume for storagetrue
persistence.accessModeReadWriteOnce or ReadOnlyReadWriteOnce
persistence.storageClassStorage class of Nexus PVCnil
persistence.storageSizeSize of Nexus data volume8Gi
persistence.annotationsPersistent Volume annotations{}
persistence.existingClaimExisting persistent volume namenil
nexusBackup.enabledNexus backup processfalse
nexusBackup.imageNameNexus backup imagequay.io/travelaudience/docker-nexus-backup
nexusBackup.imageTagNexus backup image version1.5.0
nexusBackup.imagePullPolicyBackup image pull policyIfNotPresent
nexusBackup.env.targetBucketRequired if nexusBackup is enabled. Google Cloud Storage bucker for backups format gs://BACKUP_BUCKETnil
nexusBackup.nexusAdminPasswordNexus admin password used by the backup container to access Nexus API. This password should match the one that gets chosen by the user to replace the default admin password after the first loginadmin123
nexusBackup.persistence.enabledCreate a volume for backing Nexus configurationtrue
nexusBackup.persistence.accessModeReadWriteOnce or ReadOnlyReadWriteOnce
nexusBackup.persistence.storageClassStorage class of Nexus backup PVCnil
nexusBackup.persistence.storageSizeSize of Nexus backup data volume8Gi
nexusBackup.persistence.annotationsPV annotations for backup{}
nexusBackup.persistence.existingClaimExisting PV name for backupnil
nexusBackup.resourcesBackup resource requests and limits{}
ingress.enabledCreate an ingress for Nexustrue
ingress.annotationsAnnotations to enhance ingress configuration{}
ingress.tls.enabledEnable TLStrue
ingress.tls.secretNameName of the secret storing TLS cert, false to use the Ingress' default certificatenexus-tls
ingress.pathPath for ingress rules. GCP users should set to /*/
tolerationstolerations list[]
config.enabledEnable configmapfalse
config.mountPathPath to mount the config/sonatype-nexus-conf
config.dataConfigmap datanil
deployment.annotationsAnnotations to enhance deployment configuration{}
deployment.initContainersInit containers to run before main containersnil
deployment.postStart.commandCommand to run after starting the nexus containernil
deployment.additionalContainersAdd additional Containernil
deployment.additionalVolumesAdd additional Volumesnil
deployment.additionalVolumeMountsAdd additional Volume mountsnil
secret.enabledEnable secretfalse
secret.mountPathPath to mount the secret/etc/secret-volume
secret.readOnlySecret readonly statetrue
secret.dataSecret datanil
service.enabledEnable additional servicenil
service.nameService namenil
service.portNameService port namenil
service.labelsService labelsnil
service.annotationsService annotationsnil
service.loadBalancerSourceRangesService LoadBalancer source IP whitelistnil
service.targetPortService portnil
service.portPort for exposing servicenil
serviceAccount.createAutomatically create a service accounttrue
serviceAccount.nameService account to usenil
serviceAccount.annotationsService account annotationsnil
route.enabledSet to true to create route for additional servicefalse
route.nameName of routedocker
route.portNameTarget port name of servicedocker
route.labelsLabels to be added to route{}
route.annotationsAnnotations to be added to route{}
route.pathHost name of Route e.g jenkins.example.comnil

If nexusProxy.env.cloudIamAuthEnabled is set to true the following variables need to be configured

ParameterDescriptionDefault
nexusProxy.env.clientIdGCP OAuth client IDnil
nexusProxy.env.clientSecretGCP OAuth client Secretnil
nexusProxy.env.organizationIdGCP organization IDnil
nexusProxy.env.redirectUrlOAuth callback url. example https://nexus.example.com/oauth/callbacknil
nexusProxy.env.requiredMembershipVerificationWhether users presenting valid JWT tokens must still be verified for membership within the GCP organization.true
nexusProxy.secrets.keystorebase-64 encoded value of the keystore file needed for the proxy to sign user tokens. Example: cat keystore.jceks | base64nil
nexusProxy.secrets.passwordPassword to the Java Keystore filenil
bash
$ helm install --name my-release --set persistence.enabled=false stable/sonatype-nexus

The above example turns off the persistence. Data will not be kept between restarts or deployments

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

bash
$ helm install --name my-release -f my-values.yaml stable/sonatype-nexus

Persistence

By default a PersistentVolumeClaim is created and mounted into the /nexus-data directory. In order to disable this functionality you can change the values.yaml to disable persistence which will use an emptyDir instead.

"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."

You must enable StatefulSet (statefulset.enabled=true) for true data persistence. If using Deployment approach, you can not recover data after restart or delete of helm chart. Statefulset will make sure that it picks up the same old volume which was used by the previous life of the nexus pod, helping you recover your data. When enabling statefulset, its required to enable the persistence.

As a minimum for running in production, the following settings are advised:

yaml
nexusProxy:
  env:
    nexusDockerHost: container.example.com
    nexusHttpHost: nexus.example.com

nexusBackup:
  env:
    targetBucket: "gs://my-nexus-backup"
  persistence:
    storageClass: standard

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: gce
    kubernetes.io/tls-acme: true

persistence:
  storageClass: standard
  storageSize: 1024Gi

resources:
  requests:
    cpu: 250m
    # Based on https://support.sonatype.com/hc/en-us/articles/115006448847#mem
    # and https://twitter.com/analytically/status/894592422382063616:
    #   Xms == Xmx
    #   Xmx <= 4G
    #   MaxDirectMemory >= 2G
    #   Xmx + MaxDirectMemory <= RAM * 2/3 (hence the request for 4800Mi)
    #   MaxRAMFraction=1 is not being set as it would allow the heap
    #     to use all the available memory.
    memory: 4800Mi

After Installing the Chart

After installing the chart a couple of actions need still to be done in order to use nexus. Please follow the instructions below.

Nexus Configuration

The following steps need to be executed in order to use Nexus:

and if GCP IAM authentication is enabled, please also check:

Nexus Usage

To see how to use Nexus with different tools like Docker, Maven, Python, and so on please check:

Disaster Recovery

In a disaster recovery scenario, the latest backup made by the nexus-backup container should be restored. In order to achieve this please follow the procedure described below: