2023-05-19 14:47:50 +08:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ReplicationController
|
|
|
|
metadata:
|
|
|
|
name: mysql
|
|
|
|
namespace: dev
|
|
|
|
labels:
|
|
|
|
name: mysql
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
name: mysql
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
name: mysql
|
|
|
|
spec:
|
2023-09-15 12:06:10 +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-05-19 14:47:50 +08:00
|
|
|
containers:
|
|
|
|
- name: mysql
|
|
|
|
image: mysql:8.0.33
|
2023-08-28 22:44:28 +08:00
|
|
|
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"]
|
2023-05-19 14:47:50 +08:00
|
|
|
ports:
|
|
|
|
- containerPort: 3306
|
|
|
|
volumeMounts:
|
|
|
|
- name: mysql-data-dev
|
|
|
|
mountPath: /var/lib/mysql
|
|
|
|
env:
|
|
|
|
- name: MYSQL_ROOT_PASSWORD
|
|
|
|
value: "Beaconfire@2099"
|
|
|
|
- name: MYSQL_DATABASE
|
|
|
|
value: "devops"
|
|
|
|
- name: MYSQL_USER
|
|
|
|
value: "devops"
|
|
|
|
- name: MYSQL_PASSWORD
|
|
|
|
value: "devops"
|
|
|
|
volumes:
|
|
|
|
- name: mysql-data-dev
|
|
|
|
hostPath:
|
|
|
|
path: /data/dev/mysql
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: mysql
|
|
|
|
namespace: dev
|
|
|
|
labels:
|
|
|
|
name: mysql
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- protocol: TCP
|
|
|
|
port: 3306
|
|
|
|
targetPort: 3306
|
|
|
|
nodePort: 30016
|
|
|
|
selector:
|
|
|
|
name: mysql
|
|
|
|
type: NodePort
|