1 Star 0 Fork 23

mark.w/devops-k8s

forked from zhangyu/devops-k8s 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mongodb-stand-alone.yaml 2.46 KB
一键复制 编辑 原始数据 按行查看 历史
Edgar 提交于 2021-06-07 15:34 . 1
apiVersion: v1
kind: PersistentVolume
metadata:
name: devops-mongodb-pv
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain #回收策略
nfs:
path: /mongo-devops-dispute/
server: xxxxxx.cn-beijing.nas.aliyuncs.com # ----replace------
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
namespace: devops
name: devops-mongodb-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
---
apiVersion: v1
kind: Service
metadata:
name: mongodb
namespace: devops
labels:
app: mongodb
spec:
selector:
app: mongodb
ports:
- name: mongodb
protocol: TCP
port: 27017
targetPort: 27017
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongodb
namespace: devops
labels:
app: mongodb
spec:
selector:
matchLabels:
app: mongodb
serviceName: mongodb
replicas: 1
template:
metadata:
labels:
app: mongodb
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 60
preference:
matchExpressions:
- {key: devops-node, operator: In, values: ["beijing-node"]}
containers:
- name: mongodb
image: mongo:latest
imagePullPolicy: IfNotPresent
command:
- mongod
- "--bind_ip"
- 0.0.0.0
- "--quiet"
ports:
- name: mongodb
containerPort: 27017
env:
- name: TZ
value: Asia/Shanghai
resources:
requests:
memory: 150M
limits:
memory: 1Gi
readinessProbe:
tcpSocket:
port: 27017
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
livenessProbe:
tcpSocket:
port: 27017
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
volumeMounts:
- name: devops-mongodb-disk
mountPath: "/data/db"
#subPath: mongo-devops-dispute
volumes:
- name: devops-mongodb-disk
persistentVolumeClaim:
claimName: devops-mongodb-pvc
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hadoopeco/devops-k8s.git
[email protected]:hadoopeco/devops-k8s.git
hadoopeco
devops-k8s
devops-k8s
master

搜索帮助