48 lines
1.1 KiB
YAML
48 lines
1.1 KiB
YAML
apiVersion: v1
|
||
kind: Pod
|
||
metadata:
|
||
name: mysql
|
||
namespace: test
|
||
labels:
|
||
component: mysql
|
||
spec:
|
||
hostNetwork: true # 声明pod的网络模式为host模式,效果同docker run --net=host
|
||
volumes:
|
||
- name: mysql-data
|
||
hostPath:
|
||
path: /opt/mysql/data
|
||
nodeSelector: # 使用节点选择器将Pod调度到指定label的节点
|
||
component: mysql
|
||
containers:
|
||
- name: mysql
|
||
image: mysql:5.7
|
||
args:
|
||
- --character-set-server=utf8mb4
|
||
- --collation-server=utf8mb4_unicode_ci
|
||
ports:
|
||
- containerPort: 3306
|
||
env:
|
||
- name: MYSQL_ROOT_PASSWORD
|
||
value: "opsbase.cn"
|
||
- name: MYSQL_DATABASE
|
||
value: "cmdb"
|
||
resources:
|
||
requests:
|
||
memory: 2000Mi
|
||
cpu: 800m
|
||
limits:
|
||
memory: 4Gi
|
||
cpu: 2
|
||
readinessProbe:
|
||
tcpSocket:
|
||
port: 3306
|
||
initialDelaySeconds: 5
|
||
periodSeconds: 10
|
||
livenessProbe:
|
||
tcpSocket:
|
||
port: 3306
|
||
initialDelaySeconds: 15
|
||
periodSeconds: 20
|
||
volumeMounts:
|
||
- name: mysql-data
|
||
mountPath: /var/lib/mysql |