commit 6aaa8fc1b32fd03978fbf57ca78a71a44994db4f Author: Remy Moll Date: Wed Jul 24 11:07:52 2024 +0200 initial commit with minimal deployment configured diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fd5e57 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# Backend deployment + +## Overview + +This repository contains the necessary files for deploying the backend application to a kubernetes environment. + +## Prerequisites + +Before deploying the backend application, ensure that you have the following prerequisites: + +- Kubernetes cluster with the following components: + - ingress controller + - storage class +- `kubectl` installed (`kustomize` is usually bundled) + +## Deployment Steps + +To deploy the backend application, follow these steps: + +1. Clone this repository: `git clone https://github.com/your-repo.git` +1. Apply the kustomization: `kubectl apply -k .` + +## Configuration + +The kustomization allows for easy configuration of the backend application. To customize the deployment, modify the `kustomization.yaml` file. diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..aabc6fa --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nav-backend +spec: + replicas: 1 + selector: + matchLabels: + app: nav-backend + template: + metadata: + labels: + app: nav-backend + spec: + containers: + - name: worker + image: backend-image + ports: + - containerPort: 8000 + env: + - name: NUM_WORKERS + value: "3" + - name: OSM_CACHE_DIR + value: "/osm-cache" + volumeMounts: + - name: osm-cache + mountPath: /osm-cache + resources: + requests: + cpu: 100m + memory: 100Mi + limits: + cpu: 4 + memory: 10Gi + volumes: + - name: osm-cache + persistentVolumeClaim: + claimName: osm-cache + + \ No newline at end of file diff --git a/ingress.yaml b/ingress.yaml new file mode 100644 index 0000000..bc835e7 --- /dev/null +++ b/ingress.yaml @@ -0,0 +1,15 @@ +kind: IngressRoute +apiVersion: traefik.io/v1alpha1 +metadata: + name: nav-ingress +spec: + entryPoints: + - websecure + routes: + - match: Host(`anyway.kluster.moll.re`) + kind: Rule + services: + - name: nav-service + port: 8000 + tls: + certResolver: default-tls diff --git a/kustomization.yaml b/kustomization.yaml new file mode 100644 index 0000000..7707d1d --- /dev/null +++ b/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + + +namespace: anyway-backend +resources: + - namespace.yaml + - pvc.yaml + - deployment.yaml + - service.yaml + - ingress.yaml + +images: + - name: backend-image + newName: git.kluster.moll.re/anydev/anyway-backend + newTag: latest \ No newline at end of file diff --git a/namespace.yaml b/namespace.yaml new file mode 100644 index 0000000..0a074bd --- /dev/null +++ b/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: placeholder diff --git a/pvc.yaml b/pvc.yaml new file mode 100644 index 0000000..a7e747f --- /dev/null +++ b/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: osm-cache +spec: + storageClassName: "nfs-client" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "5Gi" diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000..c4e5de3 --- /dev/null +++ b/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: nav-service +spec: + selector: + app: nav-backend + ports: + - protocol: TCP + port: 8000 + targetPort: 8000