我只是在kubernetes集群上部署了一个nexus库。这个纽带有3个docker存储库。一个docker集线器的代理,一个私有的和一个以前的分组。
我使用haproxy作为入口控制器。是否可以部署与此处描述的配置相匹配的入口?Nexus3: Push to Docker Group Repo
我的目标是只有一个url推送和拉到docker存储库。
发布于 2020-12-03 16:59:05
我在这里发布了我的解决方案。我使用自定义注释来实现基于所请求的url来校正端点的根。
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和服务:
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: nexushttps://stackoverflow.com/questions/64636567
复制相似问题