Kubernetes Service Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 13: Line 13:
=Connecting Pods to Services=
=Connecting Pods to Services=


A service has a label selector, which is a list of all the labels a pod must possess in order for it to receive traffic from the service. The service will send traffic to all healthy pods - a pod that passes the health check - that posses all the labels contained by the service's selector.
A service has a label selector, which is a list of all the labels a pod must possess in order for it to receive traffic from the service. The service will send traffic to all ready pods - a pod whose containers have all passed the [[Kubernetes_Pod_Concepts#Container_Readiness_Check|readiness check]] - that posses all the labels contained by the service's selector.


=Service Types=
=Service Types=

Revision as of 23:37, 21 August 2019

Internal

Service

A Service is a mechanism that provides reliable TCP and UDP networking to a set of pods. As described in the Pod Lifecycle section, pods may come and go, and every time a new replacement pod is brought up, it comes with a new IP address. The service fronts an inherently dynamic set of pods and provides a reliable name and IP for the pods "represented" by that service. Additionally, the is automatically registered with the cluster's DNS service so cluster components can find services by name, which becomes DNS-resolvable. Also, in case of two or more pods, the service load balances requests between the available pods.

If the number of pods is increased by explicitly scaling the deployment, no service modification is required - the service dynamically identifies the new pods and starts to load-balance requests to them. If a pod dies, the service dynamically and transparently clears the relationship to the defunct pod, and stops sending requests into it.

Services operate at the TCP/UDP layer (level 3) and in consequence cannot provide application-layer routing. If application-layer routing is needed, a primitive named Ingress is available.

Connecting Pods to Services

A service has a label selector, which is a list of all the labels a pod must possess in order for it to receive traffic from the service. The service will send traffic to all ready pods - a pod whose containers have all passed the readiness check - that posses all the labels contained by the service's selector.

Service Types

ClusterIP

NodePort

LoadBalancer

ExternalName

Endpoint

Endpoint Controller

The endpoint controller is part of the controller manager.