Running Nexus in Kubernetes using ingress with path other than /

756 views Asked by At

I have trouble running Nexus 3 in Kubernetes via ingress, when I specify a path other than "/". Nexus does not load fully when i visit the web portal as https://www.myportal.com/mypath. I have a true certificate. This is my ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/rewrite-target: /
    ingress.kubernetes.io/add-base-url: "true"
  name: myingress
spec:
    rules:
      - host: mynexus.com
        http:
          paths:
          - path: /mypath
            backend:
              serviceName: mynexus-sonatype-nexus
              servicePort: 9988
    tls:
      - hosts:
        - mynexus.com
        secretName: mynexus-cert-secret
1

There are 1 answers

0
oldcyber On

In nexus deployment file, add the variable

spec:
  containers:
    ...
      env:
        - name: NEXUS_CONTEXT
          value: <your subpath> (for example, mypath)

Nexus will then begin to handle requests for this subpath mynexus.com/mypath