侧边栏壁纸
  • 累计撰写 156 篇文章
  • 累计收到 971 条评论
  • 博主 2024年12月12日 在线

K8S部署nexus

罗小黑
2023-01-13 / 2 评论 / 297 阅读 / 正在检测是否收录...
广告
温馨提示:
本文最后更新于2023年01月13日,已超过741天没有更新,若内容或图片失效,请留言反馈。

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nexus-pvc # 自定义
  namespace: nexus # 自定义,与本文前后所有命名空间保持一致
  labels:
    pvc: nexus-pvc # 自定义
spec:
  storageClassName: nfs-client # 创建的StorageClass的名字
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: nexus3 # 自定义
  labels:
    app: nexus3 # 自定义
  namespace: nexus # 自定义,与本文前后所有命名空间保持一致
spec:
  replicas: 1 # 副本的数量
  selector:
    matchLabels:
      app: nexus3
  template:
    metadata:
      labels:
        app: nexus3
    spec:
      containers:
        - name: nexus3
          image: sonatype/nexus3:3.42.0
          ports:
            - name: nexus3-8081
              containerPort: 8081 # 容器端口
              protocol: TCP
          resources:
            limits:
              memory: 6G
              cpu: 1000m
          imagePullPolicy: IfNotPresent
          volumeMounts:
          - name: data
            mountPath: /nexus-data # 数据路径挂载出来
      restartPolicy: Always
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: nexus-pvc # PVC的名字
            readOnly: false
      #volumes:
      #  - name: nexus-data
      #    nfs:
      #      path: /data/nfs/graph/nexus-data
      #      server: 192.168.58.106

---
kind: Service
apiVersion: v1
metadata:
  name: nexus3
  namespace: nexus
  labels:
    app: nexus3
spec:
  type: NodePort
  ports:
    - port: 8081
      targetPort: 8081
      nodePort: 30520 # 对外开发的端口,自定义
  selector:
    app: nexus3
0

打赏


评论 (2)

取消
  1. 头像
    電話行銷數據
    Windows 10 · Google Chrome
    沙发

    這則評論是寫給你的。如果您是成功的巴布沙希或想成為成功的巴布沙希。我們公司是您值得信賴的地方。
    我們的數據配置為高數據準確性。團隊非常謹慎地確保所提供數據的準確性。我們時時刻刻關注賣家並不斷更新數據。我們提供有用的信息來幫助您更好地進行行銷。我們始終致力於為您提供更好的服務,因此請選擇我們作為您的幣安資料庫並改善您的行銷。我們來找你。

    回复 删除 垃圾
  2. 头像
    ctvllmmmto
    Windows 10 · Google Chrome
    板凳

    不错不错,我喜欢看 https://www.237fa.com/

    回复 删除 垃圾