-
-
Save RossWilliamson/dffb091de2e2db5eadaa901bb9df741f to your computer and use it in GitHub Desktop.
Drupal in Kubernetes K3s on Raspberry Pi
This file contains hidden or 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
# This manifest assumes 'drupal' namespace is already present: | |
# | |
# kubectl create namespace drupal | |
# | |
# Apply the manifest with: | |
# | |
# kubectl apply -f drupal.yml | |
--- | |
kind: ConfigMap | |
apiVersion: v1 | |
metadata: | |
name: drupal-config | |
namespace: drupal | |
data: | |
# Note: This is NOT secure. Don't use this in production! | |
settings.php: |- | |
<?php | |
$databases['default']['default'] = [ | |
'database' => 'drupal', | |
'username' => 'drupal', | |
'password' => 'drupal', | |
'prefix' => '', | |
'host' => 'mariadb', | |
'port' => '3306', | |
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', | |
'driver' => 'mysql', | |
]; | |
$settings['hash_salt'] = 'OTk4MTYzYWI4N2E2MGIxNjlmYmQ2MTA4'; | |
$settings['trusted_host_patterns'] = ['^.+$']; | |
$settings['config_sync_directory'] = 'sites/default/files/config_OTk4MTYzY'; | |
--- | |
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: drupal-files-pvc | |
namespace: drupal | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
kind: Deployment | |
apiVersion: apps/v1 | |
metadata: | |
name: drupal | |
namespace: drupal | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: drupal | |
template: | |
metadata: | |
labels: | |
app: drupal | |
spec: | |
containers: | |
- name: drupal | |
image: 'drupal:8.8-apache' | |
ports: | |
- containerPort: 80 | |
livenessProbe: | |
tcpSocket: | |
port: 80 | |
initialDelaySeconds: 60 | |
readinessProbe: | |
tcpSocket: | |
port: 80 | |
initialDelaySeconds: 30 | |
volumeMounts: | |
- mountPath: /var/www/html/sites/default/ | |
name: drupal-settings | |
- mountPath: /var/www/html/sites/default/files/ | |
name: drupal-files | |
resources: | |
limits: | |
cpu: '1' | |
memory: '512Mi' | |
requests: | |
cpu: '500m' | |
memory: '256Mi' | |
volumes: | |
- name: drupal-settings | |
configMap: | |
name: drupal-config | |
- name: drupal-files | |
persistentVolumeClaim: | |
claimName: drupal-files-pvc | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: drupal | |
namespace: drupal | |
spec: | |
type: NodePort | |
ports: | |
- port: 80 | |
targetPort: 80 | |
selector: | |
app: drupal | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: drupal | |
namespace: drupal | |
spec: | |
rules: | |
- host: drupal.10.0.100.99.nip.io | |
http: | |
paths: | |
- path: / | |
backend: | |
serviceName: drupal | |
servicePort: 80 |
This file contains hidden or 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
# This manifest assumes 'drupal' namespace is already present: | |
# | |
# kubectl create namespace drupal | |
# | |
# Apply the manifest with: | |
# | |
# kubectl apply -f mariadb.yml | |
--- | |
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: mariadb-pvc | |
namespace: drupal | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
kind: Deployment | |
apiVersion: apps/v1 | |
metadata: | |
name: mariadb | |
namespace: drupal | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: mariadb | |
template: | |
metadata: | |
labels: | |
app: mariadb | |
spec: | |
containers: | |
- name: mariadb | |
image: tobi312/rpi-mariadb:10.3 | |
ports: | |
- containerPort: 3306 | |
env: | |
- name: MYSQL_DATABASE | |
value: drupal | |
- name: MYSQL_USER | |
value: drupal | |
- name: MYSQL_PASSWORD | |
value: drupal | |
- name: MYSQL_RANDOM_ROOT_PASSWORD | |
value: 'yes' | |
volumeMounts: | |
- mountPath: /var/lib/mysql/ | |
name: database | |
resources: | |
limits: | |
cpu: '2' | |
memory: '512Mi' | |
requests: | |
cpu: '500m' | |
memory: '256Mi' | |
volumes: | |
- name: database | |
persistentVolumeClaim: | |
claimName: mariadb-pvc | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: mariadb | |
namespace: drupal | |
spec: | |
ports: | |
- port: 3306 | |
targetPort: 3306 | |
selector: | |
app: mariadb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment