欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 文化 > k8s 部署 nexus3 详解

k8s 部署 nexus3 详解

2024/10/23 21:35:32 来源:https://blog.csdn.net/huangjinjin520/article/details/142921268  浏览:    关键词: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-pvnamespace: nexus-ns
spec:capacity:storage: 3GiaccessModes:- ReadWriteManynfs:server: 10.0.2.11path: "/root/share"---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: nexus-data-pvcnamespace: nexus-ns
spec:accessModes:- ReadWriteMany#storageClassName: "standard"resources:requests:storage: 2Gi

创建Deployment

nexus3-deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:namespace: nexus-nsname: nexus3labels:app: nexus3
spec:replicas: 1selector:matchLabels:app: nexus3template:metadata:labels:app: nexus3spec:containers:- name: nexus3image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/sonatype/nexus3:3.72.0imagePullPolicy: IfNotPresentports:- containerPort: 8081name: webprotocol: TCPlivenessProbe:httpGet:path: /port: 8081initialDelaySeconds: 100periodSeconds: 30failureThreshold: 6readinessProbe:httpGet:path: /port: 8081initialDelaySeconds: 100periodSeconds: 30failureThreshold: 6resources:limits:cpu: 1000mmemory: 2Girequests:cpu: 500mmemory: 2GivolumeMounts:- name: nexus-datamountPath: /nexus-datavolumes:- name: nexus-datapersistentVolumeClaim:claimName: nexus-data-pvc

创建Service

nexus3-service.yml

apiVersion: v1
kind: Service
metadata:name: nexus3namespace: nexus-nslabels:app: nexus3
spec:selector:app: nexus3type: NodePortports:- name: webprotocol: TCPport: 8081targetPort: 8081nodePort: 31081

参考

https://segmentfault.com/a/1190000040446848?utm_source=sf-similar-article

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com