mysql
# ConfigMap
kind: ConfigMap
apiVersion: v1
metadata:
name: birenchong-test-mysql-conf
namespace: birenchong-test
annotations:
kubesphere.io/creator: admin
data:
my.cnf: >
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
max_connections=1000
wait_timeout=300
sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
skip-character-set-client-handshake
skip-name-resolve
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
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
# PersistentVolume
apiVersion: v1
kind: PersistentVolume
metadata:
name: birenchong-test-mysql-data-pv
namespace: birenchong-test
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: efs-sc-static
csi:
driver: efs.csi.aws.com
volumeHandle: fs-0xxxxxxxxxxxxx3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# PersistentVolumeClaim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: birenchong-test-mysql-data-pvc
namespace: birenchong-test
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc-static
resources:
requests:
storage: 10Gi
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# StatefulSet
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: birenchong-test-mysql-v1
namespace: birenchong-test
labels:
app: birenchong-test-mysql
version: v1
annotations:
kubesphere.io/creator: admin
spec:
replicas: 1
selector:
matchLabels:
app: birenchong-test-mysql
version: v1
template:
metadata:
creationTimestamp: null
labels:
app: birenchong-test-mysql
version: v1
annotations:
logging.kubesphere.io/logsidecar-config: '{}'
spec:
volumes:
- name: volume-2ixmeo
persistentVolumeClaim:
claimName: birenchong-test-mysql-data-pvc
- name: volume-kke9bc
configMap:
name: birenchong-test-mysql-conf
items:
- key: my.cnf
path: my.cnf
defaultMode: 420
containers:
- name: mysql
image: 'mysql:8.0'
ports:
- name: tcp-3306
containerPort: 3306
protocol: TCP
- name: tcp-33060
containerPort: 33060
protocol: TCP
env:
- name: MYSQL_ROOT_PASSWORD
value: birenchong_password
- name: TZ
value: Asia/Shanghai
resources: {}
volumeMounts:
- name: volume-2ixmeo
mountPath: /var/lib/mysql
subPath: mysql/data
- name: volume-kke9bc
readOnly: true
mountPath: /etc/mysql/conf.d/my.cnf
subPath: my.cnf
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
nodeSelector:
env: devops
serviceAccountName: default
serviceAccount: default
securityContext: {}
schedulerName: default-scheduler
serviceName: birenchong-test-mysql
podManagementPolicy: OrderedReady
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 0
revisionHistoryLimit: 10
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Service-ClusterIP
kind: Service
apiVersion: v1
metadata:
name: birenchong-test-mysql
namespace: birenchong-test
labels:
app: birenchong-test-mysql
version: v1
annotations:
kubesphere.io/creator: admin
kubesphere.io/serviceType: statefulservice
spec:
ports:
- name: tcp-3306
protocol: TCP
port: 3306
targetPort: 3306
- name: tcp-33060
protocol: TCP
port: 33060
targetPort: 33060
selector:
app: birenchong-test-mysql
clusterIP: None
clusterIPs:
- None
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
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
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
# Service-NodePort
kind: Service
apiVersion: v1
metadata:
name: birenchong-test-mysql-np
namespace: birenchong-test
labels:
app: birenchong-test-mysql-np
annotations:
kubesphere.io/creator: admin
spec:
ports:
- name: tcp-3306
protocol: TCP
port: 3306
targetPort: 3306
nodePort: 32426
selector:
app: birenchong-test-mysql
version: v1
clusterIP: 10.100.74.97
clusterIPs:
- 10.100.74.97
type: NodePort
sessionAffinity: None
externalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
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
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
Last Updated: 2023/11/08, 14:45:54