54 lines
866 B
YAML
54 lines
866 B
YAML
# 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
|