Created
March 24, 2020 12:31
-
-
Save mbtamuli/0d1c661fd61929bf49df11322435c620 to your computer and use it in GitHub Desktop.
Helm Dependency
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
secretGenerator: | |
- name: mysql-pass | |
literals: | |
- password=mbtamuli | |
resources: | |
- mysql-deployment.yaml | |
- wordpress-deployment.yaml |
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: 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: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | |
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 |
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: Service | |
metadata: | |
name: wordpress | |
labels: | |
app: wordpress | |
spec: | |
ports: | |
- port: 80 | |
selector: | |
app: wordpress | |
tier: frontend | |
type: LoadBalancer | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: wp-pv-claim | |
labels: | |
app: wordpress | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 20Gi | |
--- | |
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | |
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: | |
initContainers: | |
- name: init-mydb | |
image: busybox:1.28 | |
command: | |
[ | |
"sh", | |
"-c", | |
"until nslookup wordpress-mysql.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done", | |
] | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment