nexus - choisungwook/portfolio GitHub Wiki

๊ฐœ์š”

  • nexus helm ์‚ฌ์šฉ ๋ฉ”๋‰ด์–ผ

์ค€๋น„

  • ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์„ค์น˜์™€ ํด๋Ÿฌ์Šคํ„ฐ ๊ตฌ์„ฑ
  • helm3 ์„ค์น˜
  • cert-manager ์„ค์น˜์™€ ์‚ฌ์šฉ๋ฐฉ๋ฒ• ์ดํ•ด
  • ์™ธ๋ถ€ ๋„๋ฉ”์ธ/๋„ค์ž„์„œ๋ฒ„
  • ์‹ค์Šต์—์„œ๋Š” ๋„ค์ž„์„œ๋ฒ„๋ฅผ cloudflare์‚ฌ์šฉ
  • ๋™์  ํ”„๋กœ๋น„์ €๋‹ ํ™œ์„ฑํ™”

์ €์žฅ์†Œ ์ถ”๊ฐ€

helm repo add sonatype https://sonatype.github.io/helm3-charts/
helm repo update

override_values.yaml ํŒŒ์ผ ์ƒ์„ฑ

(์˜ต์…˜1) docker + ingress subapth

  • ingress ํ™œ์„ฑํ™”
    • ingress.hostRepo: ๋„๋ฉ”์ธ์ฃผ์†Œ
  • ingress subpath ๋ณ€๊ฒฝ
    • nexus.env: NEXUS_CONTENT
    • ingress.hostPath: NEXUS_CONTENT์— ์„ค์ •ํ•œ ๊ฐ’์œผ๋กœ ๋ณ€๊ฒฝ
  • docker
    • helm nexus์—์„œ๋Š” docker ingress์„ค์ •์ด ํ•„์ˆ˜
nexus:
  docker:
    enabled: true
    registries:
      - port: 5000
        host: docker.choilab.com
        secretName: docker-ssl
  env:
  - name: NEXUS_CONTEXT
    value: nexus
  livenessProbe:
    path: /nexus
  readinessProbe:
    path: /nexus

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
  hostPath: /nexus
  hostRepo: choilab.com
  tls:
    - hosts:
      - docker.choilab.com

(์˜ต์…˜2) cert-manager + ingress + docker

์ด ์˜ˆ์ œ๋Š” dns-01 solver์„ ์‚ฌ์šฉํ•˜๊ณ  ๋„ค์ž„์„œ๋ฒ„๋ฅผ cloudflare๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

  • cloudflaer accesstoekn ์ƒ์„ฑ
apiVersion: v1
kind: Secret
metadata:
  name: cloudflare-api-token-secret
  namespace: nexus
type: Opaque
stringData:
  api-token: <your-token>
  • issuer ์ƒ์„ฑ
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: nexus-prodissuser
  namespace: nexus
spec:
  acme:
    # The ACME server URL
    server: https://acme-v02.api.letsencrypt.org/directory
    # Email address used for ACME registration
    email: <your email>
    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: nexus-prodissuser
    # Enable the challenge provider
    solvers:
      - dns01:
          cloudflare:
            email: <your email>
            apiTokenSecretRef:
              name: cloudflare-api-token-secret #cloudflare api token
              key: api-token
  • override_values.yamlํŒŒ์ผ ์ƒ์„ฑ
nexus:
  docker:
    enabled: true
    # docker domain
    registries:
      - port: 5000
        host: docker.choilab.xyz
        secretName: docker-tls
ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/issuer: "nexus-prodissuser"
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    
  hostPath: /
  # nexus domain
  hostRepo: nexus.choilab.xyz
  tls:
    # docker domain
    - hosts:
      - docker.choilab.xyz
      secretName: docker-tls
    # nexus domain
    - hosts:
      - nexus.choilab.xyz
      secretName: nexus-tls

์„ค์น˜

kubectl create ns nexus
helm install -n nexus nexus -f override_values.yaml sonatype/nexus-repository-manager

nexus docker private repo ์„ค์ •

โš ๏ธ **GitHub.com Fallback** โš ๏ธ