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
相关推荐
逐流人19 分钟前
Ceph对象存储与文件系统存储管理:从RADOS网关、S3与Swift到CephFS快照同步
linux·运维·ceph·云原生·云计算·swift·rados
分布式存储与RustFS28 分钟前
日志目录的预算是 2 GiB:轮转、保留和压缩这三件事
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
江湖有缘1 小时前
Docker实战 | 使用Docker部署Bibliotheca阅读习惯管理工具
java·docker·容器
万联WANFLOW1 小时前
Docker Hub 镜像拉取慢、timeout 的排查方法
运维·docker·云原生·容器·eureka
hhb_6182 小时前
云原生赋能模型工具高效落地
云原生
bloglin9999912 小时前
vmware部署centos7启动docker容器后无法访问服务
运维·docker·容器
weixin_4445793013 小时前
Containerd
容器·k8s
逐流人14 小时前
Ceph分布式存储集群配置与池管理:从配置优先级到PG、复本池与纠删码池
运维·分布式·ceph·云原生·云计算·rados
AutumnWind042017 小时前
【Docker Compose 快速入门】
运维·docker·容器
分布式存储与RustFS17 小时前
图床搬到自己的对象存储:PicGo 加 S3 插件的完整配置
运维·云原生·开源·对象存储·分布式存储·s3·性能基准