From f4bc75fcbe8af5a26a1b90a169a7f96c76dc2ac5 Mon Sep 17 00:00:00 2001 From: Brazing Technology Date: Wed, 29 Apr 2026 11:28:25 +0530 Subject: [PATCH] feat(k8s): web NodePort, api ClusterIP, db headless services --- service.yaml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 service.yaml diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000..f7b4261 --- /dev/null +++ b/service.yaml @@ -0,0 +1,53 @@ +# 1. web Service — NodePort, exposes the Nginx frontend to the host +apiVersion: v1 +kind: Service +metadata: + name: web + namespace: taskapp + labels: + app: web +spec: + type: NodePort + selector: + app: web + ports: + - name: http + port: 80 + targetPort: 80 + nodePort: 30080 + +--- +# 2. api Service — ClusterIP, internal-only access for Flask +apiVersion: v1 +kind: Service +metadata: + name: api + namespace: taskapp + labels: + app: api +spec: + type: ClusterIP + selector: + app: api + ports: + - name: http + port: 5000 + targetPort: 5000 + +--- +# 3. db Service — headless (clusterIP: None), pairs with the StatefulSet +apiVersion: v1 +kind: Service +metadata: + name: db + namespace: taskapp + labels: + app: db +spec: + clusterIP: None + selector: + app: db + ports: + - name: postgres + port: 5432 + targetPort: 5432