From 745751723fa7f244db71b54bdaf75620ac0101fe Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 19 Jun 2024 11:39:18 +0100 Subject: [PATCH] :boom: add all the files --- Bookstack-db.kube.yaml | 80 +++++++++++++++++++++++++++++++++++ Bookstack-webserver.kube.yaml | 63 +++++++++++++++++++++++++++ Bookstack.configmap.yaml | 11 +++++ Bookstack.secret.yaml | 14 ++++++ bookstack.kube.yaml.bak | 56 ++++++++++++++++++++++++ namespace.yaml | 5 +++ pvc.claim.yaml | 25 +++++++++++ 7 files changed, 254 insertions(+) create mode 100644 Bookstack-db.kube.yaml create mode 100644 Bookstack-webserver.kube.yaml create mode 100644 Bookstack.configmap.yaml create mode 100644 Bookstack.secret.yaml create mode 100644 bookstack.kube.yaml.bak create mode 100644 namespace.yaml create mode 100644 pvc.claim.yaml diff --git a/Bookstack-db.kube.yaml b/Bookstack-db.kube.yaml new file mode 100644 index 0000000..59161f6 --- /dev/null +++ b/Bookstack-db.kube.yaml @@ -0,0 +1,80 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: bookstack +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bookstack-database + namespace: bookstack +spec: + replicas: 1 + selector: + matchLabels: + app: bookstack-database + template: + metadata: + labels: + app: bookstack-database + spec: + containers: + - name: bookstack-database + image: lscr.io/linuxserver/mariadb + imagePullPolicy: Always + ports: + - containerPort: 3306 + name: database-port + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: bookstack-credentials + key: DB_PASS + - name: MYSQL_DATABASE + valueFrom: + secretKeyRef: + name: bookstack-credentials + key: DB_DATABASE + - name: MYSQL_USER + valueFrom: + secretKeyRef: + name: bookstack-credentials + key: DB_USER + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: bookstack-credentials + key: DB_PASS + envFrom: +# - secretRef: +# name: bookstack-credentials + - configMapRef: + name: config + + + volumeMounts: + - name: bookstack-database + mountPath: /config + + + volumes: + - name: bookstack-database + persistentVolumeClaim: + claimName: bookstack-database + securityContext: + fsGroup: 33 + +--- +apiVersion: v1 +kind: Service +metadata: + name: db + namespace: bookstack +spec: + ports: + - name: db + port: 3306 + protocol: TCP + selector: + app: bookstack-database diff --git a/Bookstack-webserver.kube.yaml b/Bookstack-webserver.kube.yaml new file mode 100644 index 0000000..c6d5fa5 --- /dev/null +++ b/Bookstack-webserver.kube.yaml @@ -0,0 +1,63 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: bookstack +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bookstack-webserver + namespace: bookstack +spec: + replicas: 1 + selector: + matchLabels: + app: bookstack-webserver + template: + metadata: + labels: + app: bookstack-webserver + spec: + nodeName: kube-master + containers: + - name: bookstack-webserver + image: lscr.io/linuxserver/bookstack + imagePullPolicy: Always + ports: + - containerPort: 80 + name: webserver-port + envFrom: + - secretRef: + name: bookstack-credentials + - configMapRef: + name: config + resources: + requests: + cpu: 300m + memory: 300M + + volumeMounts: + - name: bookstack-webserver + mountPath: /config + + + volumes: + - name: bookstack-webserver + persistentVolumeClaim: + claimName: bookstack-webserver + securityContext: + fsGroup: 33 + +--- +apiVersion: v1 +kind: Service +metadata: + name: webserver + namespace: bookstack +spec: + ports: + - name: http + port: 80 + protocol: TCP + selector: + app: bookstack-webserver diff --git a/Bookstack.configmap.yaml b/Bookstack.configmap.yaml new file mode 100644 index 0000000..02451e3 --- /dev/null +++ b/Bookstack.configmap.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: config + namespace: bookstack +data: + LOCAL_UID: "1000" + LOCAL_GID: "1000" + TZ: "Europe/London" + APP_URL: "https://bookstack.tryton.geeraert.eu" + DB_PORT: "3306" diff --git a/Bookstack.secret.yaml b/Bookstack.secret.yaml new file mode 100644 index 0000000..c9a1522 --- /dev/null +++ b/Bookstack.secret.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +data: + DB_DATABASE: Ym9va3N0YWNrYXBw + DB_HOST: ZGIuYm9va3N0YWNrLnN2Yw== + DB_PASS: VW5oYXBweS1Db21tZW5jZS1FdmVyeW9uZTQ= + DB_USER: Ym9va3N0YWNrX3VzZXJuYW1l +kind: Secret +metadata: + creationTimestamp: "2024-06-13T07:37:49Z" + name: bookstack-credentials + namespace: bookstack + resourceVersion: "20756717" + uid: 66d4cc7d-741a-49cc-979d-a8b95ffb983a +type: Opaque diff --git a/bookstack.kube.yaml.bak b/bookstack.kube.yaml.bak new file mode 100644 index 0000000..0d7f4e3 --- /dev/null +++ b/bookstack.kube.yaml.bak @@ -0,0 +1,56 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: bookstack +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: bookstack + namespace: bookstack +spec: + replicas: 1 + selector: + matchLabels: + app: bookstack + template: + metadata: + labels: + app: bookstack + spec: + containers: + - image: bookstack:latest + imagePullPolicy: IfNotPresent + name: bookstack + ports: + - containerPort: 8080 + name: bookstack-port + volumeMounts: + - name: bookstack-config + mountPath: /data + - name: bookstack-configfile + mountPath: /docker-entrypoint-initdb.d/init-mongo.jsconfigfile.txt + + volumes: + - name: bookstack-config + hostPath: + path: /opt/kubernetes/bookstack_kube/config/ + - name: bookstack-configfile + hostPath: + path: /opt/kubernetes/bookstack_kube/configfile.txt + type: File +--- +apiVersion: v1 +kind: Service +metadata: + name: bookstack + namespace: bookstack +spec: + ports: + - port: 8080 + targetPort: bookstack-port + protocol: TCP + nodePort: 30007 + type: NodePort + selector: + app: bookstack diff --git a/namespace.yaml b/namespace.yaml new file mode 100644 index 0000000..1307efd --- /dev/null +++ b/namespace.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: bookstack diff --git a/pvc.claim.yaml b/pvc.claim.yaml new file mode 100644 index 0000000..250103d --- /dev/null +++ b/pvc.claim.yaml @@ -0,0 +1,25 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: bookstack-webserver + namespace: bookstack +spec: + storageClassName: nfs-storage-intelligent + accessModes: + - ReadWriteMany + resources: + requests: + storage: 2Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: bookstack-database + namespace: bookstack +spec: + storageClassName: nfs-storage-intelligent + accessModes: + - ReadWriteMany + resources: + requests: + storage: 2Gi