82 lines
1.7 KiB
YAML
82 lines
1.7 KiB
YAML
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: wordpress-mysql
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: wordpress
|
|
tier: mysql
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: wordpress
|
|
tier: mysql
|
|
spec:
|
|
containers:
|
|
- image: mysql:5.6
|
|
name: mysql
|
|
env:
|
|
- name: MYSQL_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-pass
|
|
key: password
|
|
ports:
|
|
- containerPort: 3306
|
|
name: mysql
|
|
volumeMounts:
|
|
- name: mysql-persistent-storage
|
|
mountPath: /var/lib/mysql
|
|
volumes:
|
|
- name: mysql-persistent-storage
|
|
persistentVolumeClaim:
|
|
claimName: mysql-pv-claim
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: wordpress
|
|
labels:
|
|
app: wordpress
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: wordpress
|
|
tier: frontend
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: wordpress
|
|
tier: frontend
|
|
spec:
|
|
containers:
|
|
- image: wordpress:4.8-apache
|
|
name: wordpress
|
|
env:
|
|
- name: WORDPRESS_DB_HOST
|
|
value: wordpress-mysql
|
|
- name: WORDPRESS_DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-pass
|
|
key: password
|
|
ports:
|
|
- containerPort: 80
|
|
name: wordpress
|
|
volumeMounts:
|
|
- name: wordpress-persistent-storage
|
|
mountPath: /var/www/html
|
|
volumes:
|
|
- name: wordpress-persistent-storage
|
|
persistentVolumeClaim:
|
|
claimName: wp-pv-claim
|