| @ -0,0 +1,4 @@ | |||
| apiVersion: v1 | |||
| kind: Namespace | |||
| metadata: | |||
| name: firefly | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: Secret | |||
| metadata: | |||
| name: firefly-iii-secrets | |||
| namespace: firefly | |||
| type: Opaque | |||
| stringData: | |||
| db_password: Rey-1176 | |||
| app_key: 4VF2JAHT5PA9VCW7EUBUJCWAWV89G9PC | |||
| access_token: 4VF2JAHT5PA9VCW7EUBUJCWAWV89G9PC | |||
| mail_user: celestino_rey@ymail.com | |||
| mail_password: kbryvwxkockqckss | |||
| @ -0,0 +1,110 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: firefly-iii-upload-claim | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: firefly-iii | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - name: firefly | |||
| port: 8080 | |||
| nodePort: 30880 | |||
| targetPort: firefly-iii | |||
| selector: | |||
| app: firefly-iii | |||
| tier: frontend | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: firefly-iii | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: firefly-iii | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: firefly-iii | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: jc5x/firefly-iii:latest | |||
| name: firefly-iii | |||
| env: | |||
| - name: APP_ENV | |||
| value: local | |||
| - name: APP_KEY | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: app_key | |||
| - name: DB_HOST | |||
| value: firefly-iii-mysql | |||
| - name: DB_CONNECTION | |||
| value: mysql | |||
| - name: DB_DATABASE | |||
| value: "fireflyiii" | |||
| - name: DB_USERNAME | |||
| value: "root" | |||
| - name: DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: db_password | |||
| - name: TRUSTED_PROXIES | |||
| value: "**" | |||
| - name: MAIL_MAILER | |||
| value: smtp | |||
| - name: MAIL_HOST | |||
| value: "smtp.mail.yahoo.com" | |||
| - name: MAIL_PORT | |||
| value: "465" | |||
| - name: MAIL_FROM | |||
| value: "celestino_rey@ymail.com" | |||
| - name: MAIL_USERNAME | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: mail_user | |||
| - name: MAIL_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: mail_password | |||
| - name: MAIL_ENCRYPTION | |||
| value: "ssl" | |||
| ports: | |||
| - containerPort: 8080 | |||
| name: firefly-iii | |||
| volumeMounts: | |||
| - mountPath: "/var/www/html/firefly-iii/storage/upload" | |||
| name: firefly-iii-upload | |||
| imagePullPolicy: Always | |||
| volumes: | |||
| - name: firefly-iii-upload | |||
| persistentVolumeClaim: | |||
| claimName: firefly-iii-upload-claim | |||
| @ -0,0 +1,7 @@ | |||
| resources: | |||
| - ff-namespace.yaml | |||
| - ff-secrets.yaml | |||
| - mysql-deployment.yaml | |||
| - firefly-deployment.yaml | |||
| - php-deployment.yaml | |||
| @ -0,0 +1,69 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: firefly-iii-data-pvc | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: firefly-iii-mysql | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| ports: | |||
| - port: 3306 | |||
| selector: | |||
| app: firefly-iii | |||
| tier: mysql | |||
| clusterIP: None | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: firefly-iii-mysql | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: firefly-iii | |||
| tier: mysql | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: firefly-iii | |||
| tier: mysql | |||
| spec: | |||
| containers: | |||
| - image: mariadb:latest | |||
| name: mysql | |||
| env: | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: db_password | |||
| ports: | |||
| - containerPort: 3306 | |||
| name: mysql | |||
| volumeMounts: | |||
| - name: mysql-persistent-storage | |||
| mountPath: /var/lib/mysql | |||
| volumes: | |||
| - name: mysql-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: firefly-iii-data-pvc | |||
| @ -0,0 +1,54 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: phpmyadmin-firefly | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| selector: | |||
| app: firefly-iii | |||
| tier: phpmyadmin | |||
| type: NodePort | |||
| ports: | |||
| - name: phpadmin | |||
| port: 80 | |||
| nodePort: 30180 | |||
| targetPort: phpmyadm | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: phpmyadmin-firefly | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: firefly-iii | |||
| tier: phpmyadmin | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: firefly-iii | |||
| tier: phpmyadmin | |||
| spec: | |||
| containers: | |||
| - name: phpmyadmin | |||
| image: arm64v8/phpmyadmin | |||
| ports: | |||
| - containerPort: 80 | |||
| name: phpmyadm | |||
| env: | |||
| - name: PMA_HOST | |||
| value: firefly-iii-mysql | |||
| - name: PMA_PORT | |||
| value: "3306" | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: db_password | |||
| @ -0,0 +1,21 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: data-firefly-iii-mysql | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| volumeMode: Filesystem | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| persistentVolumeReclaimPolicy: Delete | |||
| local: | |||
| path: /mnt/data/firefly-iii-mysql/ | |||
| nodeAffinity: | |||
| required: | |||
| nodeSelectorTerms: | |||
| - matchExpressions: | |||
| - key: kubernetes.io/hostname | |||
| operator: In | |||
| values: | |||
| - crl-rbp-400 | |||
| @ -0,0 +1,21 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: data-firefly-iii | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| volumeMode: Filesystem | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| persistentVolumeReclaimPolicy: Delete | |||
| local: | |||
| path: /mnt/data/firefly-iii | |||
| nodeAffinity: | |||
| required: | |||
| nodeSelectorTerms: | |||
| - matchExpressions: | |||
| - key: kubernetes.io/hostname | |||
| operator: In | |||
| values: | |||
| - crl-rbp-400 | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: data-firefly-iii | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| accessModes: | |||
| - ReadWriteMany | |||
| nfs: | |||
| server: k8s-router | |||
| path: "/media/discoexterno/firefly-uploads" | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: data-firefly-iii-mysql | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| accessModes: | |||
| - ReadWriteMany | |||
| nfs: | |||
| server: k8s-router | |||
| path: "/media/discoexterno/firefly-db" | |||
| @ -0,0 +1,4 @@ | |||
| apiVersion: v1 | |||
| kind: Namespace | |||
| metadata: | |||
| name: firefly | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: Secret | |||
| metadata: | |||
| name: firefly-iii-secrets | |||
| namespace: firefly | |||
| type: Opaque | |||
| stringData: | |||
| db_password: Rey-1176 | |||
| app_key: 4VF2JAHT5PA9VCW7EUBUJCWAWV89G9PC | |||
| access_token: 4VF2JAHT5PA9VCW7EUBUJCWAWV89G9PC | |||
| mail_user: celestino_rey@ymail.com | |||
| mail_password: kbryvwxkockqckss | |||
| @ -0,0 +1,110 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: firefly-iii-upload-claim | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: firefly-iii | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - name: firefly | |||
| port: 8080 | |||
| nodePort: 30880 | |||
| targetPort: firefly-iii | |||
| selector: | |||
| app: firefly-iii | |||
| tier: frontend | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: firefly-iii | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: firefly-iii | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: firefly-iii | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: jc5x/firefly-iii:latest | |||
| name: firefly-iii | |||
| env: | |||
| - name: APP_ENV | |||
| value: local | |||
| - name: APP_KEY | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: app_key | |||
| - name: DB_HOST | |||
| value: firefly-iii-mysql | |||
| - name: DB_CONNECTION | |||
| value: mysql | |||
| - name: DB_DATABASE | |||
| value: "fireflyiii" | |||
| - name: DB_USERNAME | |||
| value: "root" | |||
| - name: DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: db_password | |||
| - name: TRUSTED_PROXIES | |||
| value: "**" | |||
| - name: MAIL_MAILER | |||
| value: smtp | |||
| - name: MAIL_HOST | |||
| value: "smtp.mail.yahoo.com" | |||
| - name: MAIL_PORT | |||
| value: "465" | |||
| - name: MAIL_FROM | |||
| value: "celestino_rey@ymail.com" | |||
| - name: MAIL_USERNAME | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: mail_user | |||
| - name: MAIL_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: mail_password | |||
| - name: MAIL_ENCRYPTION | |||
| value: "ssl" | |||
| ports: | |||
| - containerPort: 8080 | |||
| name: firefly-iii | |||
| volumeMounts: | |||
| - mountPath: "/var/www/html/firefly-iii/storage/upload" | |||
| name: firefly-iii-upload | |||
| imagePullPolicy: Always | |||
| volumes: | |||
| - name: firefly-iii-upload | |||
| persistentVolumeClaim: | |||
| claimName: firefly-iii-upload-claim | |||
| @ -0,0 +1,5 @@ | |||
| resources: | |||
| - ff-namespace.yaml | |||
| - ff-secrets.yaml | |||
| - mysql-deployment.yaml | |||
| - firefly-deployment.yaml | |||
| @ -0,0 +1,69 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: firefly-iii-data-pvc | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| --- | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: firefly-iii-mysql | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| ports: | |||
| - port: 3306 | |||
| selector: | |||
| app: firefly-iii | |||
| tier: mysql | |||
| clusterIP: None | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: firefly-iii-mysql | |||
| namespace: firefly | |||
| labels: | |||
| app: firefly-iii | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: firefly-iii | |||
| tier: mysql | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: firefly-iii | |||
| tier: mysql | |||
| spec: | |||
| containers: | |||
| - image: mariadb:latest | |||
| name: mysql | |||
| env: | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: firefly-iii-secrets | |||
| key: db_password | |||
| ports: | |||
| - containerPort: 3306 | |||
| name: mysql | |||
| volumeMounts: | |||
| - name: mysql-persistent-storage | |||
| mountPath: /var/lib/mysql | |||
| volumes: | |||
| - name: mysql-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: firefly-iii-data-pvc | |||
| @ -0,0 +1,21 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: data-firefly-iii-mysql | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| volumeMode: Filesystem | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| persistentVolumeReclaimPolicy: Delete | |||
| local: | |||
| path: /mnt/data/firefly-iii-mysql/ | |||
| nodeAffinity: | |||
| required: | |||
| nodeSelectorTerms: | |||
| - matchExpressions: | |||
| - key: kubernetes.io/hostname | |||
| operator: In | |||
| values: | |||
| - crl-rbp-400 | |||
| @ -0,0 +1,21 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: data-firefly-iii | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| volumeMode: Filesystem | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| persistentVolumeReclaimPolicy: Delete | |||
| local: | |||
| path: /mnt/data/firefly-iii | |||
| nodeAffinity: | |||
| required: | |||
| nodeSelectorTerms: | |||
| - matchExpressions: | |||
| - key: kubernetes.io/hostname | |||
| operator: In | |||
| values: | |||
| - crl-rbp-400 | |||
| @ -0,0 +1 @@ | |||
| Subproject commit fd1148841aebfee2fd09347c4f2511a62b879915 | |||
| @ -0,0 +1,8 @@ | |||
| secretGenerator: | |||
| - name: reevolution-pass | |||
| namespace: reevolution | |||
| literals: | |||
| - password=Rey-1176 | |||
| resources: | |||
| - mysql-deployment.yaml | |||
| - wordpress-deployment.yaml | |||
| @ -0,0 +1,68 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: reevolution-mysql | |||
| namespace: reevolution | |||
| labels: | |||
| app: reevolution | |||
| spec: | |||
| ports: | |||
| - port: 3306 | |||
| selector: | |||
| app: reevolution | |||
| tier: mysql | |||
| clusterIP: None | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: mysql-reevolution-pv-claim | |||
| namespace: reevolution | |||
| labels: | |||
| app: reevolution | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| resources: | |||
| requests: | |||
| storage: 20Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: reevolution-mysql | |||
| namespace: reevolution | |||
| labels: | |||
| app: reevolution | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: reevolution | |||
| tier: mysql | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: reevolution | |||
| tier: mysql | |||
| spec: | |||
| containers: | |||
| - image: mariadb | |||
| name: mysql | |||
| env: | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: reevolution-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-reevolution-pv-claim | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: reevolution-data | |||
| spec: | |||
| capacity: | |||
| storage: 20Gi | |||
| accessModes: | |||
| - ReadWriteMany | |||
| nfs: | |||
| server: k8s-router | |||
| path: "/media/discoexterno/reevolution-db" | |||
| @ -0,0 +1,13 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: reevolution-folder | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| accessModes: | |||
| - ReadWriteMany | |||
| nfs: | |||
| server: k8s-router | |||
| path: "/media/discoexterno/reevolution-wp" | |||
| @ -0,0 +1,73 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: reevolution | |||
| namespace: reevolution | |||
| labels: | |||
| app: reevolution | |||
| spec: | |||
| type: NodePort | |||
| ports: | |||
| - port: 80 | |||
| nodePort: 30089 | |||
| targetPort: reevolution | |||
| selector: | |||
| app: reevolution | |||
| tier: frontend | |||
| --- | |||
| apiVersion: v1 | |||
| kind: PersistentVolumeClaim | |||
| metadata: | |||
| name: reevolution-pv-claim | |||
| namespace: reevolution | |||
| labels: | |||
| app: reevolution | |||
| spec: | |||
| accessModes: | |||
| - ReadWriteMany | |||
| storageClassName: "" | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: reevolution | |||
| namespace: reevolution | |||
| labels: | |||
| app: reevolution | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: reevolution | |||
| tier: frontend | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: reevolution | |||
| tier: frontend | |||
| spec: | |||
| containers: | |||
| - image: wordpress:4.8-apache | |||
| name: reevolution | |||
| env: | |||
| - name: WORDPRESS_DB_HOST | |||
| value: reevolution-mysql | |||
| - name: WORDPRESS_DB_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: reevolution-pass | |||
| key: password | |||
| ports: | |||
| - containerPort: 80 | |||
| name: reevolution | |||
| volumeMounts: | |||
| - name: reevolution-persistent-storage | |||
| mountPath: /var/www/html | |||
| volumes: | |||
| - name: reevolution-persistent-storage | |||
| persistentVolumeClaim: | |||
| claimName: reevolution-pv-claim | |||
| @ -0,0 +1,17 @@ | |||
| apiVersion: v1 | |||
| kind: ConfigMap | |||
| metadata: | |||
| name: mysql | |||
| labels: | |||
| app: mysql | |||
| data: | |||
| primary.cnf: | | |||
| # Apply this config only on the primary. | |||
| [mysqld] | |||
| log-bin | |||
| replica.cnf: | | |||
| # Apply this config only on replicas. | |||
| [mysqld] | |||
| super-read-only | |||
| @ -0,0 +1,31 @@ | |||
| # Headless service for stable DNS entries of StatefulSet members. | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: mysql | |||
| labels: | |||
| app: mysql | |||
| spec: | |||
| ports: | |||
| - name: mysql | |||
| port: 3306 | |||
| clusterIP: None | |||
| selector: | |||
| app: mysql | |||
| --- | |||
| # Client service for connecting to any MySQL instance for reads. | |||
| # For writes, you must instead connect to the primary: mysql-0.mysql. | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: mysql-read | |||
| labels: | |||
| app: mysql | |||
| spec: | |||
| ports: | |||
| - name: mysql | |||
| port: 3306 | |||
| selector: | |||
| app: mysql | |||
| @ -0,0 +1,167 @@ | |||
| apiVersion: apps/v1 | |||
| kind: StatefulSet | |||
| metadata: | |||
| name: mysql | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: mysql | |||
| serviceName: mysql | |||
| replicas: 3 | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: mysql | |||
| spec: | |||
| initContainers: | |||
| - name: init-mysql | |||
| image: mysql:5.7 | |||
| command: | |||
| - bash | |||
| - "-c" | |||
| - | | |||
| set -ex | |||
| # Generate mysql server-id from pod ordinal index. | |||
| [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 | |||
| ordinal=${BASH_REMATCH[1]} | |||
| echo [mysqld] > /mnt/conf.d/server-id.cnf | |||
| # Add an offset to avoid reserved server-id=0 value. | |||
| echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf | |||
| # Copy appropriate conf.d files from config-map to emptyDir. | |||
| if [[ $ordinal -eq 0 ]]; then | |||
| cp /mnt/config-map/primary.cnf /mnt/conf.d/ | |||
| else | |||
| cp /mnt/config-map/replica.cnf /mnt/conf.d/ | |||
| fi | |||
| volumeMounts: | |||
| - name: conf | |||
| mountPath: /mnt/conf.d | |||
| - name: config-map | |||
| mountPath: /mnt/config-map | |||
| - name: clone-mysql | |||
| image: gcr.io/google-samples/xtrabackup:1.0 | |||
| command: | |||
| - bash | |||
| - "-c" | |||
| - | | |||
| set -ex | |||
| # Skip the clone if data already exists. | |||
| [[ -d /var/lib/mysql/mysql ]] && exit 0 | |||
| # Skip the clone on primary (ordinal index 0). | |||
| [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 | |||
| ordinal=${BASH_REMATCH[1]} | |||
| [[ $ordinal -eq 0 ]] && exit 0 | |||
| # Clone data from previous peer. | |||
| ncat --recv-only mysql-$(($ordinal-1)).mysql 3307 | xbstream -x -C /var/lib/mysql | |||
| # Prepare the backup. | |||
| xtrabackup --prepare --target-dir=/var/lib/mysql | |||
| volumeMounts: | |||
| - name: data | |||
| mountPath: /var/lib/mysql | |||
| subPath: mysql | |||
| - name: conf | |||
| mountPath: /etc/mysql/conf.d | |||
| containers: | |||
| - name: mysql | |||
| image: mysql:5.7 | |||
| env: | |||
| - name: MYSQL_ALLOW_EMPTY_PASSWORD | |||
| value: "1" | |||
| ports: | |||
| - name: mysql | |||
| containerPort: 3306 | |||
| volumeMounts: | |||
| - name: data | |||
| mountPath: /var/lib/mysql | |||
| subPath: mysql | |||
| - name: conf | |||
| mountPath: /etc/mysql/conf.d | |||
| resources: | |||
| requests: | |||
| cpu: 500m | |||
| memory: 1Gi | |||
| livenessProbe: | |||
| exec: | |||
| command: ["mysqladmin", "ping"] | |||
| initialDelaySeconds: 30 | |||
| periodSeconds: 10 | |||
| timeoutSeconds: 5 | |||
| readinessProbe: | |||
| exec: | |||
| # Check we can execute queries over TCP (skip-networking is off). | |||
| command: ["mysql", "-h", "127.0.0.1", "-e", "SELECT 1"] | |||
| initialDelaySeconds: 5 | |||
| periodSeconds: 2 | |||
| timeoutSeconds: 1 | |||
| - name: xtrabackup | |||
| image: gcr.io/google-samples/xtrabackup:1.0 | |||
| ports: | |||
| - name: xtrabackup | |||
| containerPort: 3307 | |||
| command: | |||
| - bash | |||
| - "-c" | |||
| - | | |||
| set -ex | |||
| cd /var/lib/mysql | |||
| # Determine binlog position of cloned data, if any. | |||
| if [[ -f xtrabackup_slave_info && "x$(<xtrabackup_slave_info)" != "x" ]]; then | |||
| # XtraBackup already generated a partial "CHANGE MASTER TO" query | |||
| # because we're cloning from an existing replica. (Need to remove the tailing semicolon!) | |||
| cat xtrabackup_slave_info | sed -E 's/;$//g' > change_master_to.sql.in | |||
| # Ignore xtrabackup_binlog_info in this case (it's useless). | |||
| rm -f xtrabackup_slave_info xtrabackup_binlog_info | |||
| elif [[ -f xtrabackup_binlog_info ]]; then | |||
| # We're cloning directly from primary. Parse binlog position. | |||
| [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1 | |||
| rm -f xtrabackup_binlog_info xtrabackup_slave_info | |||
| echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\ | |||
| MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in | |||
| fi | |||
| # Check if we need to complete a clone by starting replication. | |||
| if [[ -f change_master_to.sql.in ]]; then | |||
| echo "Waiting for mysqld to be ready (accepting connections)" | |||
| until mysql -h 127.0.0.1 -e "SELECT 1"; do sleep 1; done | |||
| echo "Initializing replication from clone position" | |||
| mysql -h 127.0.0.1 \ | |||
| -e "$(<change_master_to.sql.in), \ | |||
| MASTER_HOST='mysql-0.mysql', \ | |||
| MASTER_USER='root', \ | |||
| MASTER_PASSWORD='', \ | |||
| MASTER_CONNECT_RETRY=10; \ | |||
| START SLAVE;" || exit 1 | |||
| # In case of container restart, attempt this at-most-once. | |||
| mv change_master_to.sql.in change_master_to.sql.orig | |||
| fi | |||
| # Start a server to send backups when requested by peers. | |||
| exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \ | |||
| "xtrabackup --backup --slave-info --stream=xbstream --host=127.0.0.1 --user=root" | |||
| volumeMounts: | |||
| - name: data | |||
| mountPath: /var/lib/mysql | |||
| subPath: mysql | |||
| - name: conf | |||
| mountPath: /etc/mysql/conf.d | |||
| resources: | |||
| requests: | |||
| cpu: 100m | |||
| memory: 100Mi | |||
| volumes: | |||
| - name: conf | |||
| emptyDir: {} | |||
| - name: config-map | |||
| configMap: | |||
| name: mysql | |||
| volumeClaimTemplates: | |||
| - metadata: | |||
| name: data | |||
| spec: | |||
| accessModes: ["ReadWriteOnce"] | |||
| resources: | |||
| requests: | |||
| storage: 10Gi | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: mysql-data-01 | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| nfs: | |||
| server: haproxy-a-01 | |||
| path: "/media/discodatos/mysql-data-01" | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: mysql-data-02 | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| nfs: | |||
| server: haproxy-a-01 | |||
| path: "/media/discodatos/mysql-data-02" | |||
| @ -0,0 +1,12 @@ | |||
| apiVersion: v1 | |||
| kind: PersistentVolume | |||
| metadata: | |||
| name: mysql-data-03 | |||
| spec: | |||
| capacity: | |||
| storage: 10Gi | |||
| accessModes: | |||
| - ReadWriteOnce | |||
| nfs: | |||
| server: haproxy-a-01 | |||
| path: "/media/discodatos/mysql-data-03" | |||
| @ -0,0 +1,3 @@ | |||
| kubectl create -f pv-mysql.yaml | |||
| kubectl create -f pv-wordpress.yaml | |||
| kubectl create -k ./ | |||
| @ -1,7 +1,9 @@ | |||
| secretGenerator: | |||
| - name: mysql-pass | |||
| - name: mysqlwp-pass | |||
| namespace: wordpress | |||
| literals: | |||
| - password=Dsa-0213 | |||
| resources: | |||
| - mysql-deployment.yaml | |||
| - wordpress-deployment.yaml | |||
| - php-deployment.yaml | |||
| @ -0,0 +1,54 @@ | |||
| apiVersion: v1 | |||
| kind: Service | |||
| metadata: | |||
| name: phpmyadmin-wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| app: wordpress | |||
| tier: phpmyadmin | |||
| type: NodePort | |||
| ports: | |||
| - name: phpadmin | |||
| port: 80 | |||
| nodePort: 30280 | |||
| targetPort: phpmyadm | |||
| --- | |||
| apiVersion: apps/v1 | |||
| kind: Deployment | |||
| metadata: | |||
| name: phpmyadmin-wordpress | |||
| namespace: wordpress | |||
| labels: | |||
| app: wordpress | |||
| spec: | |||
| selector: | |||
| matchLabels: | |||
| app: wordpress | |||
| tier: phpmyadmin | |||
| strategy: | |||
| type: Recreate | |||
| template: | |||
| metadata: | |||
| labels: | |||
| app: wordpress | |||
| tier: phpmyadmin | |||
| spec: | |||
| containers: | |||
| - name: phpmyadmin | |||
| image: arm64v8/phpmyadmin | |||
| ports: | |||
| - containerPort: 80 | |||
| name: phpmyadm | |||
| env: | |||
| - name: PMA_HOST | |||
| value: wordpress-mysql | |||
| - name: PMA_PORT | |||
| value: "3306" | |||
| - name: MYSQL_ROOT_PASSWORD | |||
| valueFrom: | |||
| secretKeyRef: | |||
| name: mysqlwp-pass | |||
| key: password | |||