Skip to content

Instantly share code, notes, and snippets.

@lengshuiyulangcn
Last active April 5, 2022 05:59
Show Gist options
  • Save lengshuiyulangcn/e12d929edb111047d5b5babb5ab84acf to your computer and use it in GitHub Desktop.
Save lengshuiyulangcn/e12d929edb111047d5b5babb5ab84acf to your computer and use it in GitHub Desktop.
deploy script for mysql on k8s
kind: Deployment
apiVersion: apps/v1
metadata:
name: mysql
labels:
app: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:5.7
name: mysql
args: [
"--ignore-db-dir=lost+found",
]
env:
- name: MYSQL_ROOT_PASSWORD
value: your_pass_word
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-local-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-local-storage
persistentVolumeClaim:
claimName: mysql
---
apiVersion: v1
kind: Service
metadata:
name: mysql-service
spec:
selector:
app: mysql
ports:
- protocol: TCP
port: 3306
targetPort: 3306
clusterIP: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment