Networking Service
A Service is an API resource that defines a logical set of pods and a policy by which to access them, and is an abstracted manner to expose applications as network services.
Kubernetes gives pods their own IP addresses and a single DNS name for a set of pods. Services are used as entrypoints to load-balance the traffic across the pods. A selector determines the set of Pods targeted by a Service.
For example, if you have a set of pods that each listen on TCP port 9191
and carry a label app=MyKonvoyApp
, as configured in the following:
apiVersion: v1
kind: Service
metadata:
name: my-konvoy-service
namespace: default
spec:
selector:
app: MyKonvoyApp
ports:
- protocol: TCP
port: 80
targetPort: 9191
This specification creates a new Service
object named "my-konvoy-service"
, that targets TCP port 9191
on any pod with the app=MyKonvoyApp
label.
Kubernetes assigns this Service an IP address. In particular, the kube-proxy
implements a form of virtual IP for Services of type other than ExternalName
.
The name of a Service object must be a valid DNS label name.
A Service is not a Platform Service.