-
-
Save geerlingguy/4613ea753d2286b6ed0cb4e3c272ce23 to your computer and use it in GitHub Desktop.
| # 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 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 |
Thanks for these. I've been following your tutorial episode 4. Unfortunately I'm pretty new to all this. I'm getting a:
error: unable to recognize "drupal.yml": no matches for kind "Ingress" in version "extensions/v1beta1"
When running the manifest.
@RossWilliamson - That should probably be extensions/v1 I think, now, and it needs a couple other formatting changes for the actual ingress resource.
@geerlingguy Thanks! I did some googling and the following seemed to work (I don't think you can do pull requests with gists so I'll paste it here). Again - I'm just learning so this worked for me but may well not be correct (I have no idea what the pathType: ImplementationSpecific does yet.)
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: drupal
namespace: drupal
spec:
rules:
- host: drupal.192.168.1.101.nip.io
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: drupal
port:
number: 80For those of you running into the image pull error for MariaDB, I changed the image to tobi312/rpi-mariadb:10.6-ubuntu and it seems to work on Raspberry Pi OS.
Hi Jeff
I keep getting this error on installation of drupal....

Not sure how to proceed from here...
Regards Ron