OKR/tob-upgrade/mongo/mongo.yaml

73 lines
1.6 KiB
YAML
Raw Normal View History

2023-06-01 19:28:28 +08:00
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
spec:
replicas: 1
serviceName: mongo
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
2023-11-06 11:33:27 +08:00
initContainers:
- name: init
image: busybox
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
sysctl -w net.ipv4.tcp_keepalive_time=300
sysctl -w net.ipv4.tcp_keepalive_intvl=10
sysctl -w net.ipv4.tcp_keepalive_probes=3
securityContext:
privileged: true
2023-06-01 19:28:28 +08:00
containers:
- name: mongo
image: mongo:6.0.6
imagePullPolicy: IfNotPresent
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: root
- name: MONGO_INITDB_ROOT_PASSWORD
2023-11-06 11:33:27 +08:00
value: 'beaconfireinc123'
2023-06-01 19:28:28 +08:00
ports:
- containerPort: 27017
volumeMounts:
- name: mongo-data
mountPath: /data/db
2023-11-06 11:33:27 +08:00
volumes:
- name: mongo-data
hostPath:
path: /data/tcs/mongo
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
2025-02-14 10:14:01 +08:00
- bfs-k8snode-10-2-3-6.hetzner.base.beaconfireinc.com
2023-06-01 19:28:28 +08:00
---
apiVersion: v1
kind: Service
metadata:
name: mongo
spec:
selector:
app: mongo
ports:
- name: mongo
protocol: TCP
port: 27017
targetPort: 27017
nodePort: 30018
type: NodePort
2023-11-06 11:33:27 +08:00