【使用docker 搭建Java仓库 nexus 】

yaml

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  annotations:
    k8s.eip.work/displayName: Nexus服务
    k8s.eip.work/ingress: 'false'
    k8s.eip.work/service: ClusterIP
    k8s.eip.work/workload: nexus
  labels:
    k8s.eip.work/layer: db
    k8s.eip.work/name: nexus
    k8s.kuboard.cn/name: nexus
  name: nexus
  namespace: normal-system
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s.eip.work/layer: db
      k8s.eip.work/name: nexus
  serviceName: db-nexus
  template:
    metadata:
      labels:
        k8s.eip.work/layer: db
        k8s.eip.work/name: nexus
    spec:
      containers:
        - image: 'sonatype/nexus3:3.39.0'
          imagePullPolicy: IfNotPresent
          name: nexus
          resources: { }
          securityContext:
            allowPrivilegeEscalation: true
            privileged: true
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /nexus-data
              name: nexus-data
            - mountPath: /etc/localtime
              name: tz
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: { }
      terminationGracePeriodSeconds: 30
      volumes:
        - hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai
            type: File
          name: tz
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
    - apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        annotations:
          k8s.eip.work/pvcType: Dynamic
        name: nexus-data
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 10Gi
        storageClassName: nfs1-storage
        volumeMode: Filesystem

---
apiVersion: v1
kind: Service
metadata:
  annotations:
    k8s.eip.work/displayName: Nexus服务
    k8s.eip.work/workload: nexus
  labels:
    k8s.eip.work/layer: db
    k8s.eip.work/name: nexus
  name: nexus
  namespace: normal-system
spec:
  ipFamilyPolicy: SingleStack
  ports:
    - name: njz35c
      nodePort: 31004
      port: 8081
      protocol: TCP
      targetPort: 8081
  selector:
    k8s.eip.work/layer: db
    k8s.eip.work/name: nexus
  sessionAffinity: None
  type: NodePort


你可能感兴趣的:(kubernetes,docker,java,容器,kubernetes)