From 80bfdc203d8b0bf4d506259fc249e0afd9cac006 Mon Sep 17 00:00:00 2001 From: Dmitry Shurco Date: Sat, 12 Oct 2024 21:26:47 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8E=20ci:=20kubernetes=20manifest=20ex?= =?UTF-8?q?ample?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++ k8s/litecart.yaml | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 k8s/litecart.yaml diff --git a/README.md b/README.md index f0fded8..cd8ff9f 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,10 @@ docker run \ ghcr.io/shurco/litecart:latest ``` +####  Run using Kubernetes +An example manifest for running on Kubernetes can be found in the `/k8s/` folder (thanks @vuisme) + + ## ⬇️  Updating > [!WARNING] > Before any update, be sure to make a backup of the *./lc_base* folder and the *./site* folder. diff --git a/k8s/litecart.yaml b/k8s/litecart.yaml new file mode 100644 index 0000000..f8e7267 --- /dev/null +++ b/k8s/litecart.yaml @@ -0,0 +1,95 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: litecart-pvc + namespace: shop +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 2Gi + storageClassName: longhorn-sg + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: litecart + namespace: shop +spec: + replicas: 1 + selector: + matchLabels: + app: litecart + template: + metadata: + labels: + app: litecart + spec: + nodeSelector: + type: sg + containers: + - name: litecart + image: shurco/litecart:latest + ports: + - containerPort: 8080 + volumeMounts: + - name: litecart-storage + mountPath: /lc_base + subPath: lc_base + - name: litecart-storage + mountPath: /lc_digitals + subPath: lc_digitals + - name: litecart-storage + mountPath: /lc_uploads + subPath: lc_uploads + - name: litecart-storage + mountPath: /site + subPath: site + volumes: + - name: litecart-storage + persistentVolumeClaim: + claimName: litecart-pvc + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: litecart-ingress + namespace: shop + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + nginx.ingress.kubernetes.io/ssl-redirect: "true" +spec: + ingressClassName: nginx + tls: + - hosts: + - domain + secretName: litecart-tls + rules: + - host: domain + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: litecart-service + port: + number: 8080 + +--- +apiVersion: v1 +kind: Service +metadata: + name: litecart-service + namespace: shop +spec: + selector: + app: litecart + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 + type: NodePort \ No newline at end of file