在 Kubernetes 上托管的 Nexus Docker 存储库的入口
Ingress for Nexus Docker repository hosted on Kubernetes
我只是将一个 nexus 存储库部署到 kubernetes 集群。这个关系有 3 docker 个存储库。 docker 集线器的一个代理,一个私有的和一个都在前面的组。
我使用 haproxy 作为入口控制器。是否可以部署与此处描述的配置相匹配的入口?
我的目标是只有一个 url 可以推送和拉取到 docker 存储库。
我post这里是我的解决方案。我使用自定义注释来实现生根以根据请求的 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/ last;
}
rewrite ^/(.*)$ /repository/docker-public/ last;
}
location ~ ^/(v1|v2)/ {
if ($request_method ~* (POST|PUT|DELETE|PATCH) ) {
rewrite ^/(.*)$ /repository/docker-private/ last;
}
rewrite ^/(.*)$ /repository/docker-public/ 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: nexus
我只是将一个 nexus 存储库部署到 kubernetes 集群。这个关系有 3 docker 个存储库。 docker 集线器的一个代理,一个私有的和一个都在前面的组。
我使用 haproxy 作为入口控制器。是否可以部署与此处描述的配置相匹配的入口?
我的目标是只有一个 url 可以推送和拉取到 docker 存储库。
我post这里是我的解决方案。我使用自定义注释来实现生根以根据请求的 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/ last;
}
rewrite ^/(.*)$ /repository/docker-public/ last;
}
location ~ ^/(v1|v2)/ {
if ($request_method ~* (POST|PUT|DELETE|PATCH) ) {
rewrite ^/(.*)$ /repository/docker-private/ last;
}
rewrite ^/(.*)$ /repository/docker-public/ 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: nexus