diff --git a/gobank-api-deployment.yaml b/gobank-api-deployment.yaml deleted file mode 100644 index 5472102..0000000 --- a/gobank-api-deployment.yaml +++ /dev/null @@ -1,73 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: gobank-api - labels: - app: gobank-api -spec: - replicas: 2 - selector: - matchLabels: - app: gobank-api - template: - metadata: - labels: - app: gobank-api - spec: - containers: - - name: gobank-api - image: ghcr.io/hypernaser/gobank:latest - ports: - - containerPort: 8080 - resources: - requests: - cpu: "100m" - memory: "64Mi" - limits: - cpu: "500m" - memory: "128Mi" - env: - - name: PGPASSWORD - valueFrom: - secretKeyRef: - name: db-creds - key: password - - name: PGUSER - valueFrom: - secretKeyRef: - name: db-creds - key: username - - name: DB_SOURCE - value: "postgres://gobank-db-rw:5432/gobank?sslmode=disable" ---- -# The Service (The Internal Load Balancer) -apiVersion: v1 -kind: Service -metadata: - name: gobank-api-service -spec: - selector: - app: gobank-api - ports: - - protocol: TCP - port: 80 - targetPort: 8080 ---- -# The Ingress (The External Load Balancer) -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: gobank-ingress - annotations: - traefik.ingress.kubernetes.io/router.entrypoints: web -spec: - rules: - - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: gobank-api-service - port: - number: 80 \ No newline at end of file diff --git a/k3d-config.yaml b/k3d-config.yaml index 07d9504..1ff0867 100644 --- a/k3d-config.yaml +++ b/k3d-config.yaml @@ -6,7 +6,7 @@ servers: 1 agents: 2 image: rancher/k3s:v1.36.0-rc3-k3s1 kubeAPI: - hostIP: "0.0.0.0" + hostIP: "127.0.0.1" hostPort: "6550" ports: - port: 80:80 diff --git a/k8s/apps/gobank/gobank-api-deployment.yaml b/k8s/apps/gobank/deployment.yaml similarity index 69% rename from k8s/apps/gobank/gobank-api-deployment.yaml rename to k8s/apps/gobank/deployment.yaml index 060fdbd..70dc13f 100644 --- a/k8s/apps/gobank/gobank-api-deployment.yaml +++ b/k8s/apps/gobank/deployment.yaml @@ -56,36 +56,4 @@ spec: name: db-creds key: username - name: DB_SOURCE - value: "postgres://gobank-db-rw:5432/gobank?sslmode=disable" ---- -# The Service (The Internal Load Balancer) -apiVersion: v1 -kind: Service -metadata: - name: gobank-api-service -spec: - selector: - app: gobank-api - ports: - - protocol: TCP - port: 80 - targetPort: 8080 ---- -# The Ingress (The External Load Balancer) -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: gobank-ingress - annotations: - traefik.ingress.kubernetes.io/router.entrypoints: web -spec: - rules: - - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: gobank-api-service - port: - number: 80 \ No newline at end of file + value: "postgres://gobank-db-rw:5432/gobank?sslmode=disable" \ No newline at end of file diff --git a/k8s/apps/gobank/ingress.yaml b/k8s/apps/gobank/ingress.yaml new file mode 100644 index 0000000..8a461de --- /dev/null +++ b/k8s/apps/gobank/ingress.yaml @@ -0,0 +1,17 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gobank-ingress + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: web +spec: + rules: + - http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: gobank-api-service + port: + number: 80 diff --git a/k8s/apps/gobank/kustomization.yaml b/k8s/apps/gobank/kustomization.yaml index 6b992fe..eb19900 100644 --- a/k8s/apps/gobank/kustomization.yaml +++ b/k8s/apps/gobank/kustomization.yaml @@ -5,4 +5,6 @@ namespace: gobank resources: - namespace.yaml - postgres-cluster.yaml - - gobank-api-deployment.yaml \ No newline at end of file + - gobank-api-deployment.yaml + - service.yaml + - ingress.yaml \ No newline at end of file diff --git a/k8s/apps/gobank/service.yaml b/k8s/apps/gobank/service.yaml new file mode 100644 index 0000000..e3c19db --- /dev/null +++ b/k8s/apps/gobank/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: gobank-api-service +spec: + selector: + app: gobank-api + ports: + - protocol: TCP + port: 80 + targetPort: 8080 diff --git a/postgres-cluster.yaml b/postgres-cluster.yaml deleted file mode 100644 index bb84009..0000000 --- a/postgres-cluster.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: postgresql.cnpg.io/v1 -kind: Cluster -metadata: - name: gobank-db -spec: - instances: 3 - - imageName: ghcr.io/cloudnative-pg/postgresql:18.3 - - bootstrap: - initdb: - database: gobank - owner: root - secret: - name: db-creds - - storage: - size: 1Gi - - affinity: - enablePodAntiAffinity: true - topologyKey: kubernetes.io/hostname \ No newline at end of file