2023-08-18 14:42:45 +08:00
|
|
|
apiVersion: v1
|
|
|
|
kind: ReplicationController
|
|
|
|
metadata:
|
|
|
|
name: mysql
|
|
|
|
labels:
|
|
|
|
name: mysql
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
name: mysql
|
2023-08-18 15:27:15 +08:00
|
|
|
nodeAffinity:
|
|
|
|
required:
|
|
|
|
nodeSelectorTerms:
|
|
|
|
- key: kubernetes.io/hostname
|
|
|
|
operator: In
|
|
|
|
values:
|
|
|
|
- bfs-k8snode-10-2-2-6.hetzner.base.beaconfireinc.com
|
2023-08-18 14:42:45 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
name: mysql
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: mysql
|
|
|
|
image: mysql:8.0.33
|
|
|
|
ports:
|
|
|
|
- containerPort: 3306
|
|
|
|
volumeMounts:
|
2023-08-18 14:53:00 +08:00
|
|
|
- name: mysql-data-prod
|
2023-08-18 14:42:45 +08:00
|
|
|
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@2099"
|
|
|
|
volumes:
|
2023-08-18 14:53:00 +08:00
|
|
|
- name: mysql-data-prod
|
2023-08-18 14:42:45 +08:00
|
|
|
hostPath:
|
2023-08-18 14:53:00 +08:00
|
|
|
path: /data/prod/mysql
|
2023-08-18 14:42:45 +08:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: mysql
|
|
|
|
labels:
|
|
|
|
name: mysql
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- protocol: TCP
|
|
|
|
port: 3306
|
|
|
|
targetPort: 3306
|
|
|
|
nodePort: 30012
|
|
|
|
selector:
|
|
|
|
name: mysql
|
|
|
|
type: NodePort
|