fix: mysql terminated

main
ycz008 2023-09-15 14:08:02 +08:00
parent 27de4075ed
commit 0f51f912c0
4 changed files with 52 additions and 47 deletions

View File

@ -1,33 +1,3 @@
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-dev-0
labels:
type: local
spec:
storageClassName: local-mongo
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
local:
path: /data/dev/mongo
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- trainer
- key: kubernetes.io/hostname
operator: In
values:
- bfs-k8snode-10-2-0-12.hetzner.base.beaconfireinc.com
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
@ -43,6 +13,19 @@ spec:
labels:
app: mongo
spec:
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
containers:
- name: mongo
image: mongo:6.0.6
@ -57,15 +40,19 @@ spec:
volumeMounts:
- name: mongo-data
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: mongo-data
spec:
accessModes: ['ReadWriteOnce']
storageClassName: local-mongo
resources:
requests:
storage: 5Gi
volumes:
- name: mongo-data
hostPath:
path: /data/dev/mongo
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-0-12.hetzner.base.beaconfireinc.com
---
apiVersion: v1

View File

@ -1,8 +0,0 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-mongo
provisioner: kubernetes.io/no-provisioner
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer

View File

@ -13,6 +13,19 @@ spec:
labels:
app: mongo
spec:
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
containers:
- name: mongo
image: mongo:6.0.6

View File

@ -13,6 +13,19 @@ spec:
labels:
name: mysql
spec:
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
containers:
- name: mysql
image: mysql:8.0.33