k8s 部署 nexus3 详解

创建命名空间

nexus3-namespace.yaml

复制代码
apiVersion: v1
kind: Namespace
metadata:
  name: nexus-ns

创建pv&pvc

nexus3-pv-pvc.yaml

复制代码
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-pv
  namespace: nexus-ns
spec:
  capacity:
    storage: 3Gi
  accessModes:
    - ReadWriteMany
  nfs:
    server: 10.0.2.11
    path: "/root/share"

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nexus-data-pvc
  namespace: nexus-ns
spec:
  accessModes:
    - ReadWriteMany
  #storageClassName: "standard"
  resources:
    requests:
      storage: 2Gi

创建Deployment

nexus3-deployment.yml

复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: nexus-ns
  name: nexus3
  labels:
    app: nexus3
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nexus3
  template:
    metadata:
      labels:
        app: nexus3
    spec:
      containers:
      - name: nexus3
        image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/sonatype/nexus3:3.72.0
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 8081
            name: web
            protocol: TCP
        livenessProbe:
          httpGet:
            path: /
            port: 8081
          initialDelaySeconds: 100
          periodSeconds: 30
          failureThreshold: 6
        readinessProbe:
          httpGet:
            path: /
            port: 8081
          initialDelaySeconds: 100
          periodSeconds: 30
          failureThreshold: 6
        resources:
          limits:
            cpu: 1000m
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 2Gi
        volumeMounts:
        - name: nexus-data
          mountPath: /nexus-data
      volumes:
        - name: nexus-data
          persistentVolumeClaim:
            claimName: nexus-data-pvc

创建Service

nexus3-service.yml

复制代码
apiVersion: v1
kind: Service
metadata:
  name: nexus3
  namespace: nexus-ns
  labels:
    app: nexus3
spec:
  selector:
    app: nexus3
  type: NodePort
  ports:
    - name: web
      protocol: TCP
      port: 8081
      targetPort: 8081
      nodePort: 31081

参考

复制代码
https://segmentfault.com/a/1190000040446848?utm_source=sf-similar-article
相关推荐
张洛闻Eren3 小时前
MySQL 维护稳定系统【MySQL第二课】
linux·数据库·mysql·云原生
Linux-18744 小时前
分布式链路追踪系统之skywalking 追踪案例
云原生·skywalking·分布式链路追踪系统·应用程序性能监控·skywalking java agent·skywalking python agent
虎头金猫5 小时前
如何在群晖NAS上通过Docker部署CloudSaver?群晖部署CloudSaver教程|聚合资源搜索并实现远程访问
运维·服务器·网络·python·docker·容器·pandas
mounter6257 小时前
MACsec 全景解析:从技术演进、核心架构到 DPU 硬件卸载与 K8s 大规模调度实战
linux·kubernetes·linux kernel·kernel·macsec
阿里云云原生8 小时前
当拨测遇上 APM:STAROps Agent 如何区分网络问题与后端问题
云原生
fatcoder12 小时前
玩转Docker 08 — 实战:容器化真实后端并编排
后端·docker·容器
皮皮蟹虾饺12 小时前
NCCL 源码解析:通信器从出生到消亡的完整一生
linux·人工智能·ubuntu·语言模型·kubernetes
江湖有缘15 小时前
5款开源wiki知识库工具,支持Docker快速部署!
docker·容器·开源
云烟成雨TD18 小时前
Micrometer 系列【68】统一观测:基于 Spring Boot 的生产级演示案例 | 跨进程场景
spring boot·云原生·链路追踪
云烟成雨TD18 小时前
Micrometer 系列【67】统一观测:基于 Spring Boot 的生产级演示案例 | 跨线程场景
spring boot·云原生·链路追踪