Files
kubernetes/prod/drupal/drupal.yaml
T
2026-05-31 16:07:30 +02:00

165 lines
3.3 KiB
YAML

apiVersion: v1
kind: Namespace
metadata:
name: drupal
---
apiVersion: v1
kind: ConfigMap
metadata:
name: apache-servername
namespace: drupal
data:
servername.conf: |
ServerName drupal-prod.allarddcs.nl
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: drupal
namespace: drupal
labels:
app: drupal
spec:
replicas: 1
selector:
matchLabels:
app: drupal
template:
metadata:
labels:
app: drupal
spec:
initContainers:
- name: init-sites-volume
image: drupal
command: ['/bin/bash', '-c']
args: ['chown www-data:www-data /var/www/html/sites -R']
volumeMounts:
- name: drupal-data
mountPath: /var/www/html/sites
subPath: sites
containers:
- name: drupal
image: drupal:latest
imagePullPolicy: Always
env:
- name: ServerName
value: drupal-prod.allarddcs.nl
- name: MYSQL_DATABASE
value: drupal
- name: MYSQL_USER
value: drupal
- name: MYSQL_PASSWORD
value: drupal
- name: MYSQL_ROOT_PASSWORD
value: "jamesbrown"
ports:
- containerPort: 80
volumeMounts:
- name: drupal-data
mountPath: /var/www/html/modules
subPath: modules
- name: drupal-data
mountPath: /var/www/html/profiles
subPath: profiles
- name: drupal-data
mountPath: /var/www/html/themes
subPath: themes
- name: drupal-data
mountPath: /var/www/html/sites
subPath: sites
- name: apache-config
mountPath: /etc/apache2/conf-enabled/servername.conf
subPath: servername.conf
volumes:
- name: drupal-data
persistentVolumeClaim:
claimName: drupal-pvc
- name: apache-config
configMap:
name: apache-servername
---
apiVersion: v1
kind: Service
metadata:
name: drupal
namespace: drupal
labels:
app: drupal
spec:
sessionAffinity: None
ports:
- protocol: TCP
port: 80
selector:
app: drupal
type: ClusterIP
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: drupal-tls
namespace: drupal
spec:
entryPoints:
- websecure
routes:
- match: Host(`drupal-prod.allarddcs.nl`)
kind: Rule
services:
- name: drupal
port: 80
tls:
certResolver: letsencrypt
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: drupal-http
namespace: drupal
spec:
entryPoints:
- web
routes:
- match: Host(`drupal-prod.allarddcs.nl`)
kind: Rule
services:
- name: drupal
port: 80
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: drupal-pv
spec:
storageClassName: ""
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
mountOptions:
- hard
- nfsvers=4.1
nfs:
server: 192.168.2.111
path: /mnt/nfs_share/prod/drupal
readOnly: false
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: drupal-pvc
namespace: drupal
spec:
storageClassName: ""
volumeName: drupal-pv
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 1Gi