freeleaps-ops/docs/examples/service-example.yaml
2025-09-04 00:58:59 -07:00

55 lines
866 B
YAML

# ClusterIP Service (Internal Access)
apiVersion: v1
kind: Service
metadata:
name: web-app-service
namespace: my-app
labels:
app: web-app
spec:
type: ClusterIP
selector:
app: web-app
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
---
# NodePort Service (External Access via Node)
apiVersion: v1
kind: Service
metadata:
name: web-app-nodeport
namespace: my-app
labels:
app: web-app
spec:
type: NodePort
selector:
app: web-app
ports:
- name: http
port: 80
targetPort: 80
nodePort: 30080
protocol: TCP
---
# LoadBalancer Service (Cloud Load Balancer)
apiVersion: v1
kind: Service
metadata:
name: web-app-lb
namespace: my-app
labels:
app: web-app
spec:
type: LoadBalancer
selector:
app: web-app
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP