Service API Reference¶
Kubernetes Services define a logical set of Pods and a policy by which to access them, often referred to as a
microservice. The set of Pods targeted by a Service is determined by a
Service Key Features & Limitations¶
- Load Balancing: Services offer load balancing, distributing network traffic across the Pods.
- Service Types: Supports different types, such as ClusterIP (default), NodePort, LoadBalancer, and ExternalName.
- Stable IP Address: Each Service has a stable IP address, even when the Pods it routes to change.
- Immutable Selector: Once a Service is created, its
typefields cannot be updated.
- Single Namespace: Services can only route to Pods within the same namespace.
- ExternalName Limitation:
ExternalNametype is not supported by this controller.
Here's a basic example of a Service that routes traffic to Pods with the label
apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app: MyApp ports: - protocol: TCP port: 80 targetPort: 8080
In this example:
- The Service is named
- It targets Pods with the label
- The Service exposes port 80, which routes to target port 8080 on the Pods.
Service documentation provides an overview of its key features, limitations, and basic examples of configuration
within Kubernetes. For detailed specifications and advanced configurations, refer to the official
Kubernetes Service documentation.