8e5b17cf13
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
63 lines
1.3 KiB
YAML
63 lines
1.3 KiB
YAML
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: wordpress-mysql
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
ports:
|
|
- port: 3306
|
|
selector:
|
|
app: wordpress
|
|
tier: mysql
|
|
clusterIP: None
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: mysql-pv-claim
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 20Gi
|
|
---
|
|
apiVersion: extensions/v1beta1
|
|
kind: Deployment
|
|
metadata:
|
|
name: wordpress-mysql
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: wordpress
|
|
tier: mysql
|
|
spec:
|
|
containers:
|
|
- image: mysql:5.6
|
|
name: mysql
|
|
env:
|
|
# $ kubectl create secret generic mysql-pass --from-file=password.txt
|
|
# make sure password.txt does not have a trailing newline
|
|
- name: MYSQL_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-pass
|
|
key: password.txt
|
|
ports:
|
|
- containerPort: 3306
|
|
name: mysql
|
|
volumeMounts:
|
|
- name: mysql-persistent-storage
|
|
mountPath: /var/lib/mysql
|
|
volumes:
|
|
- name: mysql-persistent-storage
|
|
persistentVolumeClaim:
|
|
claimName: mysql-pv-claim
|