zkt26/z2/k8s/service.yaml

60 lines
1.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

###############################################################
# Service Flask web application (NodePort for browser access)
###############################################################
apiVersion: v1
kind: Service
metadata:
name: todo-app-service
namespace: todo-app
labels:
app: todo-app
spec:
type: NodePort
selector:
app: todo-app
ports:
- name: http
port: 80
targetPort: 5000
nodePort: 30080 # access via http://<minikube-ip>:30080
---
###############################################################
# Service PostgreSQL (ClusterIP, internal only)
###############################################################
apiVersion: v1
kind: Service
metadata:
name: postgres-service
namespace: todo-app
labels:
app: postgres
spec:
type: ClusterIP
selector:
app: postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
---
###############################################################
# Headless Service required by StatefulSet for stable DNS
###############################################################
apiVersion: v1
kind: Service
metadata:
name: postgres-headless
namespace: todo-app
labels:
app: postgres
spec:
clusterIP: None
selector:
app: postgres
ports:
- name: postgres
port: 5432
targetPort: 5432