feat(k8s): web NodePort, api ClusterIP, db headless services
This commit is contained in:
parent
61bd2cd37a
commit
f4bc75fcbe
53
service.yaml
Normal file
53
service.yaml
Normal file
@ -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
|
||||||
Loading…
Reference in New Issue
Block a user