# Nexus 云环境部署

# Namespace

$ kubectl create namespace devops

# 部署

nexus-deployment.yml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nexus
  namespace: devops
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nexus
  template:
    metadata:
      labels:
        app: nexus
    spec:
      containers:
      - name: nexus
        image: 172.16.62.204:30085/puyuan/nexus3:3.29.0
        imagePullPolicy: Always
        ports:
        - containerPort: 8081
          name: port
          protocol: TCP
        resources:
          limits:
            cpu: 1000m
            memory: 2Gi
          requests:
            cpu: 1000m
            memory: 2Gi
        volumeMounts:
          - name: data
            mountPath: /nexus-data # Nexus数据存储目录
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: nexus-data

# 服务暴漏

nexus-svc.yml

---
apiVersion: v1
kind: Service
metadata:
  name: nexus
  namespace: devops
  labels:
    app: nexus
spec:
  selector:
    app: nexus
  type: NodePort
  ports:
  - name: port
    port: 8081
    targetPort: port
    nodePort: 30077
上次更新: 2023-4-3 17:15:20