Skip to content

Instantly share code, notes, and snippets.

@AlexGluck
Last active April 19, 2025 06:26
Show Gist options
  • Save AlexGluck/aca78a90520a929b1b1efc933540e60c to your computer and use it in GitHub Desktop.
Save AlexGluck/aca78a90520a929b1b1efc933540e60c to your computer and use it in GitHub Desktop.
ingress-nginx manifests for sonatype nexus docker repositories
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ingress-nginx-controller
data:
http-snippet: "proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=nexus:100m inactive=30d max_size=2g use_temp_path=off;"
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/server-snippet: |
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Forwarded-Proto $scheme;
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-api
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: "/$1$is_args$args"
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/api/(.*)"
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker-push
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: "/repository/$2/$1/$2/$2/$3/blobs/uploads/$is_args$args"
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: '/(v1|v2)/([-_0-9a-z\.]+)/(.*)/blobs/uploads/$'
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker-login
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: "/repository/docker-login/$1/$2$is_args$args"
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/(v1|v2)/$"
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker-search
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: "/repository/docker-group/$1/$2$is_args$args"
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/(v1|v2)/(_catalog|search)$"
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker-registry-fallback-latest
annotations:
nginx.ingress.kubernetes.io/app-root: "/repository/docker-group/$1/$2$is_args$args"
nginx.ingress.kubernetes.io/configuration-snippet: |
internal;
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/nexus-ingress-docker-registry-fallback-latest"
pathType: Exact
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker-pull-norepo
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: "/repository/library/$1/library/library/$2/$3$is_args$args"
nginx.ingress.kubernetes.io/configuration-snippet: |
error_page 404 500 = /nexus-ingress-docker-registry-fallback-latest;
proxy_intercept_errors on;
recursive_error_pages on;
proxy_cache nexus;
proxy_cache_valid 500 10d;
proxy_cache_min_uses 3;
proxy_cache_valid 404 15m;
proxy_cache_use_stale http_500;
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/(v1|v2)/([-_0-9a-z\\.]+)/(blobs/sha256.*|manifests/.*)$"
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/app-root: "/repository/$2/$1/$2/$3$is_args$args"
nginx.ingress.kubernetes.io/configuration-snippet: |
error_page 404 500 = /nexus-ingress-docker-registry-fallback;
proxy_intercept_errors on;
recursive_error_pages on;
proxy_cache nexus;
proxy_cache_valid 500 10d;
proxy_cache_min_uses 3;
proxy_cache_valid 404 15m;
proxy_cache_use_stale http_500;
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/(v1|v2)/([-_0-9a-z\\.]+)/(.*)$"
pathType: Prefix
backend:
service:
name: nexus
port:
name: nexus
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-ingress-docker-registry-fallback
annotations:
nginx.ingress.kubernetes.io/app-root: "/repository/$2/$1/$3$is_args$args"
nginx.ingress.kubernetes.io/configuration-snippet: |
internal;
error_page 404 500 = /nexus-ingress-docker-registry-fallback-latest;
proxy_intercept_errors on;
recursive_error_pages on;
proxy_cache nexus;
proxy_cache_valid 500 10d;
proxy_cache_min_uses 3;
proxy_cache_valid 404 15m;
proxy_cache_use_stale http_500;
spec:
ingressClassName: nginx
rules:
- host: nexus.example.org
http:
paths:
- path: "/nexus-ingress-docker-registry-fallback"
pathType: Exact
backend:
service:
name: nexus
port:
name: nexus
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment