-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysql-deployment.yaml
64 lines (64 loc) · 1.34 KB
/
mysql-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-custom-config
namespace: ranger
data:
mysql.custom.conf: |
[mysqld]
log_bin_trust_function_creators=1
default_authentication_plugin=mysql_native_password
#https://dev.to/yoshiyukikato/tips-to-use-mysql-80-on-kubernetes-m3l
---
apiVersion: v1
kind: Service
metadata:
name: ranger-mysql
namespace: ranger
spec:
ports:
- name: tcp
port: 3306
protocol: TCP
targetPort: 3306
selector:
app: mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
namespace: ranger
spec:
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:8.0.26
name: mysql
env:
# Use secret in real usage
- name: MYSQL_ROOT_PASSWORD
value: 'root'
- name: MYSQL_USER
value: 'rangeradmin'
- name: MYSQL_PASSWORD
value: 'rangeradmin'
- name: MYSQL_DATABASE
value: 'ranger'
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: custom-config
mountPath: /etc/mysql/conf.d/default-custom.cnf
subPath: mysql.custom.conf
volumes:
- name: custom-config
configMap:
name: mysql-custom-config