Kubernetes Service
Why Service needs?
Kubernetes Pods are born and when they die, they are not resurrected. Using deployment, we can assign desired state of the pod. Deployment can create and destroy Pods dynamically. In cluster, If some set of Pods (call them "backends") provides functionality to other Pods (call them "frontends"). Frontends Pods find out and keeep track of which IP address to connect to, so that the frontend can use backend part of the the Pods.
In Kubernetes, a Service defines a logical set of Pods and a Policy by which we can access them. A service in kubernetes is a REST object, similar to object. We can create POST service to create a new instance. The set of Pods targeted by a service is determined by a selector. Frontends Pods do not care which backend they use. While the actual Pods that compose the backend set may change, the frontend clients should not need to be aware of that, nor should they need to keep track of the set of backend themselves. Kubernetes APIS can query the API server to get endpoint for service discovery in your application.
How we can define Service ?
Service can be defined using selector (a set of Pod targeted by service) or without selector. Selector controller discover Pods running state and update state. Without selector approach is required when there is any external configuration of database or service to service in different name spec.
Kubernetes Service Properties |
Conclusion:
Service describe set of Pod which can be accessed by other Pod. Service can be also defined when there is any external configuration is present without Pod.
Comments
Post a Comment