You want to point your Service to a Service in a different.Test environment you use your own databases. You want to have an external database cluster in production, but in your.Services most commonly abstract access to Kubernetes Pods, but they can also The default protocol for Services is TCP you can also use any otherĪs many Services need to expose more than one port, Kubernetes supports multipleĮach port definition can have the same protocol, or a different one. Version of your backend software, without breaking clients. This offers a lot of flexibility for deploying and evolving your Services.įor example, you can change the port numbers that Pods expose in the next Protocol available via different port numbers. Of Pods in the Service using a single configured name, with the same network Port definitions in Pods have names, and you can reference these names in the By default andįor convenience, the targetPort is set to the same value as the port Note: A Service can map any incoming port to a targetPort. The name of a Service object must be a validįor example, suppose you have a set of Pods where each listens on TCP port 9376 REST objects, you can POST a Service definition to the API server to create Defining a ServiceĪ Service in Kubernetes is a REST object, similar to a Pod. If you're able to use Kubernetes APIs for service discovery in your application,įor Endpoints, that get updated whenever the set of Pods in a Service changes.įor non-native applications, Kubernetes offers ways to place a network port or loadīalancer in between your application and the backend Pods. The Service abstraction enables this decoupling. While the actual Pods that compose the backend set may change, theįrontend clients should not need to be aware of that, nor should they need to keep Those replicas are fungible-frontends do not care which backend To learn about other ways to define Service endpoints,įor example, consider a stateless image-processing backend which is running withģ replicas. The set of Pods targeted by a Service is usually determined In Kubernetes, a Service is an abstraction which defines a logical set of PodsĪnd a policy by which to access them (sometimes this pattern is calledĪ micro-service). To, so that the frontend can use the backend part of the workload? How do the frontends find out and keep track of which IP address to connect This leads to a problem: if some set of Pods (call them "backends") providesįunctionality to other Pods (call them "frontends") inside your cluster, The set of Pods running that application a moment later. Running in one moment in time could be different from It can create and destroy Pods dynamically.Įach Pod gets its own IP address, however in a Deployment, the set of Pods Kubernetes Pods are created and destroyed Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods,Īnd can load-balance across them. With Kubernetes you don't need to modify your application to use an unfamiliar service discovery mechanism. An abstract way to expose an application running on a set of Pods as a network service.