k8s 部署 nexus3

Posted wh-blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了k8s 部署 nexus3相关的知识,希望对你有一定的参考价值。

1. nexus3是什么?

nexus3是一个统一的仓库系统,可以作为nuget、docker、maven、npm等的仓库,可以使用一个平台管理。

2. 部署

apiVersion: v1
kind: PersistentVolume
metadata:
  name: nexus-data
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: /var/nfs/nexus-data
    server: 192.168.0.250
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nexus-data-pvc
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 5Gi
  storageClassName: nfs
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nexus-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nexus
  template:
    metadata:
      labels:
        app: nexus
    spec:
      containers:
      - name: nexus
        image: sonatype/nexus3
        ports:
        -  containerPort: 8081
        -  containerPort: 8082
        -  containerPort: 8083
        volumeMounts:
        - mountPath: /nexus-data
          name: nexus-data
      volumes:
        - name: nexus-data
          persistentVolumeClaim:
            claimName: nexus-data-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: nexus-svc
spec:
  selector:
    app: nexus
  type: NodePort
  ports:
    - name: web
      protocol: TCP
      port: 8081
      targetPort: 8081
      nodePort: 30081
    - name: docker
      protocol: TCP
      port: 8082
      targetPort: 8082
      nodePort: 30082
    - name: maven
      protocol: TCP
      port: 8083
      targetPort: 8083
      nodePort: 30083

3.配置

  • docker仓库设置 8082 的代理端口
  • 配置访问权限,Security->Realms 把 Docker Bearer Token Realm 移到右边的框中保存。

以上是关于k8s 部署 nexus3的主要内容,如果未能解决你的问题,请参考以下文章

Nexus3 部署备份与恢复

Nexus3 部署备份与恢复

Ubuntu部署和体验Nexus3

Docker快速部署Nexus3

Docker快速部署Nexus3

深入浅出FE(十三)前端nexus3 Yarn离线部署npm仓库