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
相关推荐
坚持的小马27 分钟前
k8s中执行脚本如果提示etcd找不到,可以做如下的操作
容器·kubernetes·etcd
easy_coder30 分钟前
从HDFS NN报错看Flink+K8s+HDFS:基础、架构与问题关联
hdfs·flink·kubernetes
回忆是昨天里的海2 小时前
k8s-部署springboot容器化应用
java·容器·kubernetes
立早正文2 小时前
Docker从零到一部署DNMP+Redis《全程干货》
docker·容器·php
hkNaruto2 小时前
【k8s】Kubernetes 资源限制设置规范手册 MB与MiB的概念混淆问题
云原生·容器·kubernetes
Mr. Cao code3 小时前
实战:Docker构建Haproxy负载均衡镜像
linux·运维·ubuntu·docker·容器·负载均衡
Xander W4 小时前
基于K8s集群的PyTorch DDP 框架分布式训练测试(开发机版)
人工智能·pytorch·分布式·python·深度学习·kubernetes
pp-周子晗(努力赶上课程进度版)5 小时前
Docker、Kubernetes与AWS中控机是什么?
docker·容器·kubernetes·aws
曾经的三心草8 小时前
最新版本组件的docker下载-Seata
运维·docker·容器
不爱笑的良田10 小时前
从零开始的云原生之旅(十一):压测实战:验证弹性伸缩效果
云原生·容器·kubernetes·go·压力测试·k6