在Kubernetes中使用路径不是/的ingress运行Nexus

iovurdzv  于 2023-08-03  发布在  Kubernetes
关注(0)|答案(1)|浏览(95)

我在Kubernetes中通过ingress运行Nexus 3时遇到了问题,因为我指定的路径不是“/”。当我以https://www.myportal.com/mypath的身份访问门户网站时,Nexus没有完全加载。我有真实的证明。这是我的入口:

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

字符串

h6my8fg2

h6my8fg21#

在Nexus部署文件中,添加变量

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

字符串
然后,Nexus将开始处理此子路径mynexus.com/mypath的请求

相关问题