From e44911db8eb7998dfc937750ee6374420bbba86a Mon Sep 17 00:00:00 2001 From: phil Date: Fri, 20 Dec 2024 03:27:45 +0100 Subject: [PATCH] Deplyment: fix kubernetes --- deployment/kubernetes/gisaf.yaml | 164 ++++++++++++------------------- 1 file changed, 65 insertions(+), 99 deletions(-) diff --git a/deployment/kubernetes/gisaf.yaml b/deployment/kubernetes/gisaf.yaml index 83e8e1a..50eca18 100644 --- a/deployment/kubernetes/gisaf.yaml +++ b/deployment/kubernetes/gisaf.yaml @@ -1,111 +1,33 @@ apiVersion: v1 kind: Service metadata: - name: gisaf + name: gisaf-database labels: - app: gisaf + app: gisaf-database spec: ports: - - name: "80" - nodePort: 32080 - port: 80 - targetPort: 80 - - name: "4532" - nodePort: 32432 - port: 4532 - targetPort: 4532 + - name: psql + port: 5432 + - name: redis + port: 6379 selector: - app: gisaf - type: NodePort ---- -apiVersion: v1 -kind: Pod -metadata: - name: gisaf - annotations: - io.kubernetes.cri-o.SandboxID/gisaf-backend: gisaf-cri-o - io.kubernetes.cri-o.SandboxID/gisaf-database: gisaf-cri-o - io.kubernetes.cri-o.SandboxID/gisaf-frontend: gisaf-cri-o - io.kubernetes.cri-o.SandboxID/gisaf-redis: gisaf-cri-o - io.podman.annotations.infra.name: gisaf-infra - labels: - app: gisaf -spec: - hostAliases: - - ip: "127.0.0.1" - hostnames: - - "gisaf-frontend" - - "gisaf-backend" - - "gisaf-redis" - - "gisaf-database" - containers: - - name: gisaf-database - image: code.philo.ydns.eu/philorg/gisaf-database:latest - args: - - postgres - volumeMounts: - - mountPath: /var/lib/postgresql/data - name: gisaf-pgdata - ports: - - containerPort: 4532 - hostPort: 35432 - - image: docker.io/library/redis:alpine - name: gisaf-redis - args: - - redis-server - volumeMounts: - - mountPath: /data - name: gisaf-redis - - name: gisaf-backend-initdb - image: code.philo.ydns.eu/philorg/gisaf-backend:latest - command: ["gisaf", "create-db"] - env: - - name: GISAF__DB__HOST - value: gisaf-database - - name: gisaf-backend - image: code.philo.ydns.eu/philorg/gisaf-backend:latest - env: - - name: GISAF__GISAF_LIVE__REDIS - value: redis://gisaf-redis - - name: GISAF__DB__HOST - value: gisaf-database - - name: gisaf-frontend - image: code.philo.ydns.eu/philorg/gisaf-frontend:latest - args: - - nginx - - -g - - daemon off; - ports: - - containerPort: 80 - hostPort: 8899 - volumes: - - name: gisaf-pgdata - persistentVolumeClaim: - claimName: gisaf-pgdata-pvc - - name: gisaf-redis - persistentVolumeClaim: - claimName: gisaf-redis-pvc ---- + app: gisaf-database --- apiVersion: v1 kind: Pod metadata: - name: gisaf + name: gisaf-database annotations: - io.kubernetes.cri-o.SandboxID/gisaf-backend: gisaf-cri-o io.kubernetes.cri-o.SandboxID/gisaf-database: gisaf-cri-o - io.kubernetes.cri-o.SandboxID/gisaf-frontend: gisaf-cri-o io.kubernetes.cri-o.SandboxID/gisaf-redis: gisaf-cri-o io.podman.annotations.infra.name: gisaf-infra labels: - app: gisaf + app: gisaf-database spec: hostAliases: - ip: "127.0.0.1" hostnames: - - "gisaf-frontend" - - "gisaf-backend" - "gisaf-redis" - "gisaf-database" containers: @@ -117,8 +39,8 @@ spec: - mountPath: /var/lib/postgresql/data name: gisaf-pgdata ports: - - containerPort: 4532 - hostPort: 35432 + - containerPort: 5432 + name: psql - image: docker.io/library/redis:alpine name: gisaf-redis args: @@ -126,17 +48,63 @@ spec: volumeMounts: - mountPath: /data name: gisaf-redis + ports: + - containerPort: 6379 + name: redis + volumes: + - name: gisaf-pgdata + persistentVolumeClaim: + claimName: gisaf-pgdata-pvc + - name: gisaf-redis + persistentVolumeClaim: + claimName: gisaf-redis-pvc + +--- +apiVersion: v1 +kind: Service +metadata: + name: gisaf-server + labels: + app: gisaf-server +spec: + ports: + - port: 80 + targetPort: 80 + #nodePort: 30080 + selector: + app: gisaf-server + #type: NodePort + +--- +apiVersion: v1 +kind: Pod +metadata: + name: gisaf-server + annotations: + io.kubernetes.cri-o.SandboxID/gisaf-backend: gisaf-cri-o + io.kubernetes.cri-o.SandboxID/gisaf-frontend: gisaf-cri-o + io.podman.annotations.infra.name: gisaf-infra + labels: + app: gisaf-server +spec: + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "gisaf-frontend" + - "gisaf-backend" + initContainers: - name: gisaf-backend-initdb image: code.philo.ydns.eu/philorg/gisaf-backend:latest command: ["gisaf", "create-db"] env: - name: GISAF__DB__HOST value: gisaf-database + containers: - name: gisaf-backend image: code.philo.ydns.eu/philorg/gisaf-backend:latest env: - name: GISAF__GISAF_LIVE__REDIS - value: redis://gisaf-redis + value: redis://gisaf-database - name: GISAF__DB__HOST value: gisaf-database - name: gisaf-frontend @@ -148,13 +116,7 @@ spec: ports: - containerPort: 80 hostPort: 8899 - volumes: - - name: gisaf-pgdata - persistentVolumeClaim: - claimName: gisaf-pgdata-pvc - - name: gisaf-redis - persistentVolumeClaim: - claimName: gisaf-redis-pvc + --- apiVersion: v1 kind: PersistentVolume @@ -171,6 +133,7 @@ spec: - ReadWriteMany hostPath: path: /data/gisaf-postgresql + --- apiVersion: v1 kind: PersistentVolume @@ -187,6 +150,7 @@ spec: - ReadWriteMany hostPath: path: /data/gisaf-redis + --- apiVersion: v1 kind: PersistentVolumeClaim @@ -199,6 +163,7 @@ spec: resources: requests: storage: 2Gi + --- apiVersion: v1 kind: PersistentVolumeClaim @@ -211,6 +176,7 @@ spec: resources: requests: storage: 200Mi + --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -228,13 +194,13 @@ spec: pathType: Prefix backend: service: - name: gisaf-frontend + name: gisaf-server port: number: 80 - path: /api pathType: Prefix backend: service: - name: gisaf-backend + name: gisaf-server port: number: 8081