k8s 部署 nexus3

kuzilala 2020-01-24

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 移到右边的框中保存。

相关推荐

haloha / 0评论 2010-08-06