首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >托管在Kubernetes上的Nexus Docker存储库的入口

托管在Kubernetes上的Nexus Docker存储库的入口
EN

Stack Overflow用户
提问于 2020-11-02 04:22:00
回答 1查看 446关注 0票数 0

我只是在kubernetes集群上部署了一个nexus库。这个纽带有3个docker存储库。一个docker集线器的代理,一个私有的和一个以前的分组。

我使用haproxy作为入口控制器。是否可以部署与此处描述的配置相匹配的入口?Nexus3: Push to Docker Group Repo

我的目标是只有一个url推送和拉到docker存储库。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-03 16:59:05

我在这里发布了我的解决方案。我使用自定义注释来实现基于所请求的url来校正端点的根。

代码语言:javascript
复制
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nexus-ingress-docker
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.org/client-max-body-size: "1G"
    nginx.org/proxy-buffering: "off"
    nginx.org/server-snippets: |
      location ~ ^/(v1|v2)/[^/]+/?[^/]+/blobs/ {
        if ($request_method ~* (POST|PUT|DELETE|PATCH|HEAD) ) {
            rewrite ^/(.*)$ /repository/docker-private/$1 last;
        }
        rewrite ^/(.*)$ /repository/docker-public/$1 last;
      }

      location ~ ^/(v1|v2)/ {
        if ($request_method ~* (POST|PUT|DELETE|PATCH) ) {
            rewrite ^/(.*)$ /repository/docker-private/$1 last;
        }
        rewrite ^/(.*)$ /repository/docker-public/$1 last;
      }
    nginx.org/location-snippets: |
      proxy_set_header X-Forwarded-Proto https;


spec:
  ingressClassName: nginx
  rules:
    - host: my-host
      http:
        paths:
          - backend:
              service:
                name: nexus
                port:
                  name: nexus
            path: /
            pathType: Prefix

和服务:

代码语言:javascript
复制
apiVersion: v1
kind: Service
metadata:
  name: nexus
  labels:
    app: nexus
spec:
  type: ClusterIP
  ports:
    - port: 8081
      name: nexus
    - port: 8082
      name: docker-private
    - port: 8083
      name: docker-public
  selector:
    app: nexus
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64636567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档