前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >K8S部署nexus

K8S部署nexus

作者头像
云计算小黑
发布2023-01-14 10:17:25
6970
发布2023-01-14 10:17:25
举报
文章被收录于专栏:小黑博客
代码语言:javascript
复制
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
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档