使用yaml檔案方便我們快速部屬K8s
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-deployment
spec:
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:8
env:
- name: MYSQL_ROOT_PASSWORD
value: '1234'
- name: MYSQL_USER
value: yen
- name: MYSQL_PASSWORD
value: '1234'
resources:
ports:
- containerPort: 3306
name: mysql
apiVersion: v1
kind: Service
metadata:
name: mysql-service
spec:
type: NodePort
selector:
app: mysql
ports:
- protocol : TCP
nodePort: 30306
port: 3306
targetPort: 3306
明天會進行部署與狀態確認,各位明天見~