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