You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-mysql-deployment
spec:
# Pod 副本数量维持在 1
# 补全标签选择器
replicas: 1
selector:
matchLabels:
app: medshare-mysql
template:
metadata:
labels:
app: medshare-mysql
spec:
containers:
- image: yylonly/medshare_mysql:latest
name: medshare-mysql
# 暴露 3306 端口
# 配置以下环境变量
# MYSQL_DATABASE -> ehr
# MYSQL_PASSWORD -> ehr
# MYSQL_ROOT_HOST -> '%'
# MYSQL_ROOT_PASSWORD -> "123456"
# MYSQL_USER -> ehr
ports:
- containerPort: 3306
env:
- name: MYSQL_DATABASE
value: "ehr"
- name: MYSQL_PASSWORD
value: "ehr"
- name: MYSQL_ROOT_HOST
value: "%"
- name: MYSQL_ROOT_PASSWORD
value: "123456"
- name: MYSQL_USER
value: "ehr"
---
kind: Service
apiVersion: v1
metadata:
name: mysql
spec:
# 补全标签选择器
# 以 TCP 协议代理 3306 端口
selector:
app: medshare-mysql
ports:
- name: "mysql"
protocol: TCP
port: 3306
targetPort: 3306