Services
API objects that provide reliable network endpoints and load balancing for a pod or set of pods.
Services are used to expose pods over a network. They maintain static IP addresses and DNS records, regardless of scaling, restarts, or migrations. Services choose which pods to forward traffic to based on a set of criteria defined in the service declaration, and labels defined in the pods declaration.
types of services
- Cluster IP (default): Expose the service on the cluster's network, making it only visible to other nodes in the cluster
- Node Port: Expose the service to a static port on each node's IP
- Load Balancer: Connects to an external, cloud-based load balancer for a single, stable external IP.
- External Name: Maps to a DNS name outside the cluster without proxying the traffic
- Headless: Provides no cluster IP
examples
Here's a manifest for a simple Flask-based web service.
apiVersion: v1
kind: Service
metadata:
name: flask-demo
labels:
app: flask-demo
spec:
ports:
- port: 80
protocol: TCP
name: flask-frontend
selector:
app: flask-demo
tier: frontend
type: LoadBalancer
No comments to display
No comments to display