Skip to content

Run Nexus on private k3s behind DigitalOcean

Overview

This wiki documents the full setup of Sonatype Nexus Repository as a private Docker registry running inside a private k3s cluster (no public IP), routed through DigitalOcean k3s (public IP) via Tailscale VPN, using cert-manager for TLS certificates (Let's Encrypt) and Apache APISIX as the ingress controller on both sides.

Component Value
Nexus UI https://nexus.castis.io
Docker Registry https://registry.nexus.castis.io
Ingress APISIX
TLS cert-manager + Let's Encrypt (HTTP-01)
Namespace nexus
Storage local-path-retain StorageClass
Private server Tailscale IP <NUC_TAILSCALE_IP>

Architecture

Internet
  └── DigitalOcean public IP (<DO_PUBLIC_IP>)
        └── APISIX Gateway (DO k3s)
              ├── TLS termination (cert-manager + Let's Encrypt)
              └── Upstream → Tailscale VPN (<NUC_TAILSCALE_IP>:80)
                    └── APISIX Gateway (private k3s)
                          ├── nexus.castis.io → Nexus UI (port 8081)
                          └── registry.nexus.castis.io → Docker Registry (port 8082)

Traffic flow

Browser/Docker client
  → nexus.castis.io (DNS → DO public IP)
  → DO APISIX (HTTPS :443, terminates TLS)
  → Tailscale tunnel (HTTP to <NUC_TAILSCALE_IP>:80)
  → Private APISIX (routes by Host header)
  → Nexus pod (ClusterIP service)

Prerequisites

  • Private k3s cluster (no public IP) with APISIX installed in apisix namespace
  • DigitalOcean k3s cluster with APISIX installed in ingress-apisix namespace
  • Tailscale installed on both servers, private server Tailscale IP known (tailscale ip -4)
  • cert-manager installed on DO k3s with letsencrypt-prod ClusterIssuer
  • DNS records pointing to DO public IP:
    nexus.castis.io              A    <DO public IP>
    registry.nexus.castis.io     A    <DO public IP>
    
  • Port 80 open on DO server for HTTP-01 ACME challenge

Infrastructure Setup

All files below are applied on the private k3s cluster.

Storage Class

Create a custom StorageClass with Retain policy so data survives helm uninstall or accidental PVC deletion.

# 00-storageclass.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-path-retain
provisioner: rancher.io/local-path
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
kubectl apply -f 00-storageclass.yaml

Note: If your cluster already has longhorn-retain with 2+ ready nodes, you can use that instead. Change storageClassName to longhorn-retain everywhere below.

Persistent Volume Claim

Create the PVC before deploying Nexus. The helm.sh/resource-policy: keep annotation ensures no tool ever deletes it accidentally.

# 01-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nexus-data
  namespace: nexus
  annotations:
    helm.sh/resource-policy: keep
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path-retain
  resources:
    requests:
      storage: 50Gi
kubectl create namespace nexus
kubectl apply -f 01-pvc.yaml
kubectl get pvc -n nexus   # wait for Bound

Nexus Deployment

# 02-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nexus
  namespace: nexus
  labels:
    app: nexus
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nexus
  template:
    metadata:
      labels:
        app: nexus
    spec:
      securityContext:
        fsGroup: 200
      initContainers:
        - name: fix-permissions
          image: busybox:1.36
          command: ["sh", "-c", "chown -R 200:200 /nexus-data"]
          volumeMounts:
            - name: nexus-data
              mountPath: /nexus-data
      containers:
        - name: nexus
          image: sonatype/nexus3:3.71.0   # pin version — never use latest
          securityContext:
            runAsUser: 200
          ports:
            - name: nexus-ui
              containerPort: 8081
            - name: docker-hosted
              containerPort: 8082
          env:
            - name: INSTALL4J_ADD_VM_PARAMS
              value: >-
                -Xms2703m -Xmx2703m
                -XX:MaxDirectMemorySize=2703m
                -Djava.util.prefs.userRoot=/nexus-data/javaprefs
          resources:
            requests:
              cpu: 500m
              memory: 3Gi
            limits:
              cpu: "2"
              memory: 4Gi
          volumeMounts:
            - name: nexus-data
              mountPath: /nexus-data
          livenessProbe:
            httpGet:
              path: /service/rest/v1/status
              port: 8081
            initialDelaySeconds: 120
            periodSeconds: 30
            failureThreshold: 6
          readinessProbe:
            httpGet:
              path: /service/rest/v1/status
              port: 8081
            initialDelaySeconds: 60
            periodSeconds: 15
      volumes:
        - name: nexus-data
          persistentVolumeClaim:
            claimName: nexus-data
kubectl apply -f 02-deployment.yaml
kubectl rollout status deployment/nexus -n nexus

Nexus Service

# 03-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: nexus
  namespace: nexus
spec:
  type: ClusterIP
  selector:
    app: nexus
  ports:
    - name: nexus-ui
      port: 8081
      targetPort: 8081
      protocol: TCP
    - name: docker-hosted
      port: 8082
      targetPort: 8082
      protocol: TCP
kubectl apply -f 03-service.yaml
kubectl get svc -n nexus   # verify both ports 8081 and 8082

Routing Setup

Private k3s — APISIX Route

Apply on private k3s. This tells private APISIX how to route incoming traffic to Nexus.

# 04-private-apisix-route.yaml
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: nexus-internal
  namespace: nexus
spec:
  http:
    - name: nexus-ui
      match:
        hosts:
          - nexus.castis.io
        paths:
          - "/*"
      backends:
        - serviceName: nexus
          servicePort: 8081
---
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: nexus-docker
  namespace: nexus
spec:
  http:
    - name: nexus-registry
      match:
        hosts:
          - registry.nexus.castis.io
        paths:
          - "/*"
      backends:
        - serviceName: nexus
          servicePort: 8082
kubectl apply -f 04-private-apisix-route.yaml

Private k3s — APISIX Admin API Registration

Note: Due to a known issue with the APISIX ingress controller not syncing ApisixRoute CRDs to APISIX in some versions, register routes directly via the Admin API as well.

# Get APISIX admin key from configmap
# Key: <APISIX_ADMIN_KEY> (from the APISIX configmap)

# Register Nexus UI route
curl http://127.0.0.1:9180/apisix/admin/routes/nexus-ui \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": {
        "nexus.nexus.svc.cluster.local:8081": 1
      }
    }
  }'

# Register Docker registry route
curl http://127.0.0.1:9180/apisix/admin/routes/nexus-docker \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "registry.nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": {
        "nexus.nexus.svc.cluster.local:8082": 1
      }
    }
  }'

# Verify
curl http://127.0.0.1:9180/apisix/admin/routes \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  | python3 -m json.tool | grep -E "\"id\"|\"host\""

DigitalOcean k3s — APISIX Upstream

Apply on DO k3s. Points to the private server via Tailscale.

# 05-do-apisix-upstream.yaml
apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
  name: nexus-private
  namespace: nexus
spec:
  externalNodes:
    - type: Domain
      name: "<NUC_TAILSCALE_IP>"        # private server Tailscale IP
      port: 80                  # APISIX HTTP port on private server
      weight: 1
  scheme: http
  loadbalancer:
    type: roundrobin
kubectl apply -f 05-do-apisix-upstream.yaml

DigitalOcean k3s — APISIX Route

# 06-do-apisix-route.yaml
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: nexus-ui
  namespace: nexus
spec:
  http:
    - name: nexus-ui-rule
      match:
        hosts:
          - nexus.castis.io
        paths:
          - "/*"
      upstreams:
        - name: nexus-private
          weight: 100
      plugins:
        - name: proxy-rewrite
          enable: true
          config:
            headers:
              set:
                X-Forwarded-Proto: "https"
                X-Forwarded-Host: "nexus.castis.io"
---
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
  name: nexus-docker
  namespace: nexus
spec:
  http:
    - name: nexus-docker-rule
      match:
        hosts:
          - registry.nexus.castis.io
        paths:
          - "/*"
      upstreams:
        - name: nexus-private
          weight: 100
      plugins:
        - name: proxy-rewrite
          enable: true
          config:
            headers:
              set:
                X-Forwarded-Proto: "https"
                X-Forwarded-Host: "registry.nexus.castis.io"
kubectl apply -f 06-do-apisix-route.yaml

DigitalOcean k3s — APISIX Admin API Registration

Note: Same CRD sync issue applies on DO cluster. Register routes via Admin API as well.

# Port-forward to DO APISIX admin
kubectl port-forward svc/apisix-admin -n ingress-apisix 9180:9180 &

# Register nexus UI route
curl http://127.0.0.1:9180/apisix/admin/routes/nexus-ui \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": {
        "<NUC_TAILSCALE_IP>:80": 1
      }
    },
    "plugins": {
      "proxy-rewrite": {
        "headers": {
          "set": {
            "X-Forwarded-Proto": "https",
            "X-Forwarded-Host": "nexus.castis.io"
          }
        }
      }
    }
  }'

# Register Docker registry route
curl http://127.0.0.1:9180/apisix/admin/routes/nexus-docker \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "registry.nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": {
        "<NUC_TAILSCALE_IP>:80": 1
      }
    },
    "plugins": {
      "proxy-rewrite": {
        "headers": {
          "set": {
            "X-Forwarded-Proto": "https",
            "X-Forwarded-Host": "registry.nexus.castis.io"
          }
        }
      }
    }
  }'

TLS Certificate Setup with cert-manager

Apply on DO k3s.

Certificates

# 07-do-certificate.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: nexus-tls
  namespace: nexus
spec:
  secretName: nexus-tls-secret
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
  dnsNames:
    - nexus.castis.io
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: nexus-docker-tls
  namespace: nexus
spec:
  secretName: nexus-docker-tls-secret
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
  dnsNames:
    - registry.nexus.castis.io
kubectl apply -f 07-do-certificate.yaml
kubectl get certificate -n nexus -w

ApisixTls

# 08-do-apisixtls.yaml
apiVersion: apisix.apache.org/v2
kind: ApisixTls
metadata:
  name: nexus-tls
  namespace: nexus
spec:
  hosts:
    - nexus.castis.io
  secret:
    name: nexus-tls-secret
    namespace: nexus
---
apiVersion: apisix.apache.org/v2
kind: ApisixTls
metadata:
  name: nexus-docker-tls
  namespace: nexus
spec:
  hosts:
    - registry.nexus.castis.io
  secret:
    name: nexus-docker-tls-secret
    namespace: nexus
kubectl apply -f 08-do-apisixtls.yaml

Important: After applying certificates, solver ingresses will appear with CLASS: <none>. Patch them immediately before they expire (~5 minutes):

# Watch for solver ingresses
kubectl get ingress -n nexus -w

# Patch all solver ingresses as soon as they appear
for ingress in $(kubectl get ingress -n nexus \
  -o jsonpath='{.items[*].metadata.name}'); do
  kubectl patch ingress $ingress -n nexus \
    --type merge \
    -p '{"spec":{"ingressClassName":"apisix"}}'
  echo "Patched $ingress"
done

Note: If solver ingresses still get 404 after patching, register the ACME challenge routes manually on DO APISIX (see HTTP-01 Challenge Routing Issue).


Nexus Docker Registry Setup

Initial admin setup

# Port-forward for initial setup
kubectl port-forward -n nexus deploy/nexus 8081:8081 --address 0.0.0.0

# Get admin password
kubectl exec -n nexus \
  $(kubectl get pod -n nexus -l app=nexus \
    -o jsonpath='{.items[0].metadata.name}') \
  -- cat /nexus-data/admin.password

Open http://localhost:8081 → login with admin + password above → set new password → Disable anonymous access.

Create Docker hosted repository in Nexus UI

  1. Go to ** Settings → Security → Realms**
  2. Move Docker Bearer Token Realm to Active → Save
  3. Go to ** Settings → Repository → Repositories → Create repository**
  4. Choose docker (hosted)
  5. Configure:
  6. Name: docker-hosted
  7. HTTP port: 8082
  8. Enable Docker V1 API:
  9. Blob store: default
  10. Deployment policy: Allow redeploy
  11. Save

Verify registry is accessible

# Should return UNAUTHORIZED — this is correct, means port 8082 is working
curl https://registry.nexus.castis.io/v2/

# Login
docker login registry.nexus.castis.io

# Test push
docker pull hello-world
docker tag hello-world registry.nexus.castis.io/hello-world:latest
docker push registry.nexus.castis.io/hello-world:latest

# List all images in registry
curl -u admin:<PASSWORD> https://registry.nexus.castis.io/v2/_catalog

Kubernetes Integration

imagePullSecret

Since Nexus uses a valid Let's Encrypt certificate, no registries.yaml node config is needed.

kubectl create secret docker-registry nexus-registry \
  --docker-server=registry.nexus.castis.io \
  --docker-username=admin \
  --docker-password=<PASSWORD> \
  --namespace=default

Or via YAML:

apiVersion: v1
kind: Secret
metadata:
  name: nexus-registry
  namespace: your-namespace
type: kubernetes.io/dockerconfigjson
stringData:
  .dockerconfigjson: |
    {
      "auths": {
        "registry.nexus.castis.io": {
          "username": "admin",
          "password": "<PASSWORD>",
          "auth": "<base64 of admin:<PASSWORD>>"
        }
      }
    }

Using in a Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
  namespace: your-namespace
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      imagePullSecrets:
        - name: nexus-registry
      containers:
        - name: myapp
          image: registry.nexus.castis.io/myimage:latest
          imagePullPolicy: IfNotPresent

Avoid committing secret.yaml with plain text passwords to git. Use Sealed Secrets or an external secrets manager for production.


Storing Nexus Image Inside Nexus

You can store the Nexus image itself inside Nexus for full self-sufficiency.

# Pull from public registry
docker pull sonatype/nexus3:3.71.0

# Tag for your registry
docker tag sonatype/nexus3:3.71.0 registry.nexus.castis.io/sonatype/nexus3:3.71.0

# Push to Nexus
docker push registry.nexus.castis.io/sonatype/nexus3:3.71.0

Update your Nexus deployment to use the internal image:

containers:
  - name: nexus
    image: registry.nexus.castis.io/sonatype/nexus3:3.71.0
    imagePullPolicy: IfNotPresent  # critical — avoids deadlock if Nexus is down

Always use imagePullPolicy: IfNotPresent to avoid a deadlock where k3s can't restart Nexus because it needs to pull from Nexus.


How Nexus Stores Images

Nexus stores Docker images as content-addressed blobs on disk:

/nexus-data/
  blobs/
    default/              ← default blob store
      vol-01/
        chap-0001/
          xxxxxxxx-content.bytes       ← image layer data
          xxxxxxxx-attributes.properties
  db/                     ← component metadata (tags, manifests)
  elasticsearch/          ← search index
  • Each Docker image layer is stored as a separate .bytes file identified by its SHA256 digest
  • Layers shared between images (e.g. same base OS) are stored only once, saving disk space
  • Image manifests and tags are stored in the embedded database
# Check storage usage
kubectl exec -n nexus deploy/nexus -- du -sh /nexus-data/blobs/

Browse stored images in the UI: Browse → docker-hosted → browse components


Redeployment Guide

File structure

nexus/
├── 00-storageclass.yaml           # private k3s — create once ever
├── 01-pvc.yaml                    # private k3s — create once ever
├── 02-deployment.yaml             # private k3s
├── 03-service.yaml                # private k3s
├── 04-private-apisix-route.yaml  # private k3s
├── 05-do-apisix-upstream.yaml    # DO k3s
├── 06-do-apisix-route.yaml       # DO k3s
├── 07-do-certificate.yaml        # DO k3s
└── 08-do-apisixtls.yaml          # DO k3s

Full redeployment on private k3s

export KUBECONFIG=/etc/rancher/k3s/k3s.yaml

# StorageClass and PVC only needed once ever
kubectl apply -f nexus/00-storageclass.yaml
kubectl create namespace nexus
kubectl apply -f nexus/01-pvc.yaml

# Deploy Nexus
kubectl apply -f nexus/02-deployment.yaml
kubectl apply -f nexus/03-service.yaml
kubectl rollout status deployment/nexus -n nexus

# Register routes
kubectl apply -f nexus/04-private-apisix-route.yaml

# Also register via Admin API (in case CRD sync is broken)
curl http://127.0.0.1:9180/apisix/admin/routes/nexus-ui \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": { "nexus.nexus.svc.cluster.local:8081": 1 }
    }
  }'

curl http://127.0.0.1:9180/apisix/admin/routes/nexus-docker \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "registry.nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": { "nexus.nexus.svc.cluster.local:8082": 1 }
    }
  }'

Full redeployment on DO k3s

kubectl apply -f nexus/05-do-apisix-upstream.yaml
kubectl apply -f nexus/06-do-apisix-route.yaml
kubectl apply -f nexus/07-do-certificate.yaml
kubectl apply -f nexus/08-do-apisixtls.yaml

# Also register via Admin API
kubectl port-forward svc/apisix-admin -n ingress-apisix 9180:9180 &

curl http://127.0.0.1:9180/apisix/admin/routes/nexus-ui \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": { "<NUC_TAILSCALE_IP>:80": 1 }
    },
    "plugins": {
      "proxy-rewrite": {
        "headers": {
          "set": {
            "X-Forwarded-Proto": "https",
            "X-Forwarded-Host": "nexus.castis.io"
          }
        }
      }
    }
  }'

curl http://127.0.0.1:9180/apisix/admin/routes/nexus-docker \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d '{
    "uri": "/*",
    "host": "registry.nexus.castis.io",
    "upstream": {
      "type": "roundrobin",
      "scheme": "http",
      "nodes": { "<NUC_TAILSCALE_IP>:80": 1 }
    },
    "plugins": {
      "proxy-rewrite": {
        "headers": {
          "set": {
            "X-Forwarded-Proto": "https",
            "X-Forwarded-Host": "registry.nexus.castis.io"
          }
        }
      }
    }
  }'

# Watch certificate — patch solver ingresses immediately when they appear
kubectl get ingress -n nexus -w &
kubectl get certificate -n nexus -w

Upgrade Nexus version

# Edit image tag in 02-deployment.yaml then:
kubectl apply -f nexus/02-deployment.yaml
kubectl rollout status deployment/nexus -n nexus

# Rollback if needed
kubectl rollout undo deployment/nexus -n nexus

What survives redeployment

Resource Survives
StorageClass local-path-retain cluster-scoped
PVC nexus-data helm.sh/resource-policy: keep
PV Retain policy
Nexus data on disk PV points to it
APISIX Admin API routes stored in etcd

Troubleshooting

Troubleshooting cert-manager

# Check certificate status
kubectl get certificate -n nexus

# Check challenge status
kubectl get challenges -n nexus
kubectl describe challenge -n nexus

# Check orders
kubectl get orders -n nexus

# Check cert-manager logs
kubectl logs -n cert-manager deploy/cert-manager --tail=50

HTTP-01 challenge flow

cert-manager creates Certificate
  → CertificateRequest created
    → Order created
      → Challenge created
        → Solver Pod + Service + Ingress created (class: apisix)
          → apisix-ingress-controller translates Ingress → ApisixRoute
            → Let's Encrypt hits /.well-known/acme-challenge/ from public internet
              → Certificate issued 

Key fact: The solver pod runs inside the DO cluster, not on the private server. APISIX on DO must route /.well-known/acme-challenge/* to the local solver pod, not through Tailscale.

Common Root Cause: ApisixUpstream duration unit bug

Symptom: apisix-ingress-controller spams this error continuously:

failed to list *v2.ApisixUpstream: time: missing unit in duration "10"

Cause: An ApisixUpstream resource has a healthCheck interval value without a unit suffix:

#  Wrong
healthCheck:
  active:
    healthy:
      interval: "10"

Fix: Add the s suffix:

#  Correct
healthCheck:
  active:
    healthy:
      interval: "10s"

Steps to fix:

# 1. Find the broken ApisixUpstream
kubectl get apisixupstream -A

# 2. Edit and fix the interval values
kubectl edit apisixupstream <name> -n <namespace>

# 3. Restart the ingress controller
kubectl rollout restart deploy/apisix-ingress-controller -n ingress-apisix

# 4. Delete stuck cert-manager resources
kubectl delete challenge -n nexus --all
kubectl delete order -n nexus --all
kubectl delete certificaterequest -n nexus --all

# 5. Watch certificates
kubectl get certificate -n nexus -w

This bug affects the controller globally — a bad interval in any namespace breaks certificate issuance for all namespaces.

HTTP-01 Challenge Routing Issue

Symptom: Certificate stays False, challenge shows wrong status code '404' or '400'.

Cause: APISIX ingress controller is not routing the solver ingress, or the nexus /* route intercepts the challenge path before it reaches the solver pod.

Fix: Manually register high-priority ACME challenge routes on DO APISIX pointing to the local solver pods:

# 1. Get solver service NodePorts
kubectl get svc -n nexus | grep acme
# Example output:
# cm-acme-http-solver-xxxxx  NodePort  ...  8089:32475/TCP
# cm-acme-http-solver-yyyyy  NodePort  ...  8089:30193/TCP

# 2. Get DO node internal IP
NODE_IP=$(kubectl get nodes -o wide | grep -v NAME | head -1 | awk '{print $6}')

# 3. Register challenge routes with priority 10 (higher than default 0)
curl http://127.0.0.1:9180/apisix/admin/routes/acme-nexus \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d "{
    \"uri\": \"/.well-known/acme-challenge/*\",
    \"host\": \"nexus.castis.io\",
    \"priority\": 10,
    \"upstream\": {
      \"type\": \"roundrobin\",
      \"scheme\": \"http\",
      \"nodes\": { \"$NODE_IP:32475\": 1 }
    }
  }"

curl http://127.0.0.1:9180/apisix/admin/routes/acme-nexus-docker \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -H "Content-Type: application/json" \
  -X PUT -d "{
    \"uri\": \"/.well-known/acme-challenge/*\",
    \"host\": \"registry.nexus.castis.io\",
    \"priority\": 10,
    \"upstream\": {
      \"type\": \"roundrobin\",
      \"scheme\": \"http\",
      \"nodes\": { \"$NODE_IP:30193\": 1 }
    }
  }"

# 4. Test challenge path
curl -I http://nexus.castis.io/.well-known/acme-challenge/test
# Should return 404 from solver pod (not APISIX 404)

# 5. Watch certificate
kubectl get certificate -n nexus -w

# 6. After cert is issued, delete the temporary challenge routes
curl http://127.0.0.1:9180/apisix/admin/routes/acme-nexus \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -X DELETE

curl http://127.0.0.1:9180/apisix/admin/routes/acme-nexus-docker \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  -X DELETE

Cert renewal happens every 90 days. You will need to repeat the challenge route registration each time unless the ingress controller CRD sync is fixed.

Solver ingress CLASS shows <none>

The solver ingress needs ingressClassName: apisix to be picked up by the APISIX ingress controller. Patch immediately after ingresses appear:

for ingress in $(kubectl get ingress -n nexus \
  -o jsonpath='{.items[*].metadata.name}'); do
  kubectl patch ingress $ingress -n nexus \
    --type merge \
    -p '{"spec":{"ingressClassName":"apisix"}}'
done

Verify Tailscale tunnel is working

# From DO server — should return Nexus HTML
curl -v http://<NUC_TAILSCALE_IP>:80 -H "Host: nexus.castis.io"

# Should return 400 "Not a Docker request" — this is correct
curl -v http://<NUC_TAILSCALE_IP>:80 -H "Host: registry.nexus.castis.io"

Check APISIX registered routes

# Private k3s
curl http://127.0.0.1:9180/apisix/admin/routes \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  | python3 -m json.tool | grep -E "\"id\"|\"host\"|\"uri\""

# DO k3s (via port-forward)
kubectl port-forward svc/apisix-admin -n ingress-apisix 9180:9180 &
curl http://127.0.0.1:9180/apisix/admin/routes \
  -H "X-API-KEY: <APISIX_ADMIN_KEY>" \
  | python3 -m json.tool | grep -E "\"id\"|\"host\"|\"uri\""

Quick reference — key values

Item Value
Private server Tailscale IP <NUC_TAILSCALE_IP>
Private APISIX admin key <APISIX_ADMIN_KEY> (in the private APISIX configmap)
Private APISIX HTTP port 80 (maps to node_listen: 9080 internally)
DO public IP <DO_PUBLIC_IP>
APISIX admin key (DO) <APISIX_ADMIN_KEY> (in the DO APISIX configmap)
Nexus namespace nexus
Nexus image sonatype/nexus3:3.71.0
StorageClass local-path-retain
PVC size 50Gi