Last active
May 21, 2019 19:20
-
-
Save serainville/b55635a5f808e7d12397fd81ca860d44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: db1-secrets | |
type: Opaque | |
data: | |
ROOT_PASSWORD: c3VwZXItc2VjcmV0LXBhc3N3b3JkCg== | |
SITE1_USER_PASSWORD: cGFzc3dvcmQxMjMK | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: db1-disk | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: db1-deployment | |
labels: | |
app: db1 | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: db1 | |
template: | |
metadata: | |
labels: | |
app: db1 | |
spec: | |
containers: | |
- name: db1 | |
image: mysql:5.7 | |
ports: | |
- containerPort: 3306 | |
volumeMounts: | |
- mountPath: "/var/lib/mysql" | |
subPath: "mysql" | |
name: mysqldb | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: db1-secrets | |
key: ROOT_PASSWORD | |
- name: MYSQL_USER | |
value: site1_user | |
- name: MYSQL_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: db1-secrets | |
key: SITE1_USER_PASSWORD | |
- name: MYSQL_DATABASE | |
value: site1 | |
volumes: | |
- name: mysqldb | |
persistentVolumeClaim: | |
claimName: db1-disk | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: db1-service | |
spec: | |
selector: | |
app: db1 | |
ports: | |
- protocol: TCP | |
port: 3306 | |
targetPort: 3306 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment