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
相关推荐
是垚不是土17 分钟前
探秘高可用负载均衡集群:企业网络架构的稳固基石
运维·服务器·网络·云原生·容器·架构·负载均衡
杰克逊的日记18 分钟前
大规模k8s集群怎么规划
云原生·容器·kubernetes
luck_me527 分钟前
K8S已经成为了Ai应用运行的平台工具
人工智能·容器·kubernetes
大G哥2 小时前
实战演练:用 AWS Lambda 和 API Gateway 构建你的第一个 Serverless API
云原生·serverless·云计算·gateway·aws
matrixlzp2 小时前
K8S Ingress、IngressController 快速开始
云原生·容器·kubernetes
探索云原生3 小时前
一文搞懂 GPU 共享方案: NVIDIA Time Slicing
ai·云原生·kubernetes·gpu
心动啊1215 小时前
docker使用过程中遇到概念问题
运维·docker·容器
喵叔哟6 小时前
21.【.NET 8 实战--孢子记账--从单体到微服务--转向微服务】--单体转微服务--身份认证服务拆分规划
微服务·云原生·架构
zhangxiangweide6 小时前
Docker换源
运维·docker·容器
格桑阿sir7 小时前
Kubernetes控制平面组件:Kubelet 之 Static 静态 Pod
kubernetes·k8s·kubelet·static pod·静态pod·mirror pod·镜像pod