Add common-services MariaDB & PhpMyAdmin
This commit is contained in:
parent
5b794134d9
commit
7209d83afc
2 changed files with 141 additions and 0 deletions
65
common-services/mariadb/manifest.yaml
Normal file
65
common-services/mariadb/manifest.yaml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: mariadb-secret
|
||||
type: Opaque
|
||||
data:
|
||||
# Encoded value: echo -n 'secret'|base64
|
||||
mariadb-root-password: c2VjcmV0
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mariadb-service
|
||||
labels:
|
||||
app: mariadb
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mariadb-port
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: mariadb
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mariadb-sts
|
||||
spec:
|
||||
serviceName: "mariadb-service"
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mariadb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mariadb
|
||||
spec:
|
||||
containers:
|
||||
- name: mariadb
|
||||
image: mariadb
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: mariadb-port
|
||||
env:
|
||||
# Using Secrets
|
||||
- name: MARIADB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mariadb-secret
|
||||
key: mariadb-root-password
|
||||
volumeMounts:
|
||||
- name: datadir
|
||||
mountPath: /var/lib/mysql/
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: datadir
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
storageClassName: "csi-cinder-classic"
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
76
common-services/phpmyadmin/manifest.yaml
Normal file
76
common-services/phpmyadmin/manifest.yaml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mariadb-configmap
|
||||
data:
|
||||
database_url: mariadb-service
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: phpmyadmin-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: pma
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: pma
|
||||
spec:
|
||||
containers:
|
||||
- name: phpmyadmin
|
||||
image: bitnami/phpmyadmin:latest
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
- name: DATABASE_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: mariadb-configmap
|
||||
key: database_url
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: pma
|
||||
spec:
|
||||
selector:
|
||||
app: pma
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
|
||||
---
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: pma
|
||||
spec:
|
||||
entryPoints: # We listen to requests coming from ports 80 and 443
|
||||
- web
|
||||
- websecure
|
||||
routes:
|
||||
- match: Host(`pma.k8sldc.openevents.fr`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: pma # Requests will be forwarded to this service
|
||||
port: 8080
|
||||
tls:
|
||||
secretName: pma.k8sldc.openevents.fr
|
||||
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: pma.k8sldc.openevents.fr
|
||||
spec:
|
||||
dnsNames:
|
||||
- pma.k8sldc.openevents.fr
|
||||
secretName: pma.k8sldc.openevents.fr
|
||||
issuerRef:
|
||||
name: selfsigned # Use the issuer created previously
|
||||
kind: ClusterIssuer
|
||||
Loading…
Add table
Reference in a new issue