Pods: One or more containers that shares the storage and network with a Kubernetes configuration, mentioning the behavior of those containers.
A Kubernetes service is outlined as a logical set of pods that perform identical functions. These will be accessed through the DNS name of the service. Services can also define policies for their access.
Since the pods are transient, a service enables or permits a group of pods, which give specific functions like web services, image processing. This to be assigned a name and unique IP address as clusterIP. As long as the service is running that IP address, it will not change
It is quite easy to manage load balancing configuration by using Service,. It also helps pods to scale easily.
Deployment v/s Service
Deployment is a methodology of launching a pod with containerized applications. This ensures that the sufficient number of replicas are continuously running on the cluster.
Service is responsible for exposing an interface to those pods. this allows network access from either inside the cluster or between external processes and also the service.
Core Attributes of a Kubernetes Service
Kubernetes service connects a group of pods to an abstracted service name and IP address. Service gives discovery and routing between pods. As an example,, services connect an application front-end to its backend, each of which running in separate deployments in a cluster. Services use labels and selectors to match pods with other applications.
The core attributes of a Kubernetes service are:
1.A label selector that locates pods that are targeted by a service
- For kubernetes native applications, whenever there is a change to a group of pods in a service, the endpoints API will also get updated.
- a virtual-IP-based bridge to services redirects to backend pods for non-native applications.
- The clusterIP- the IP address and assigned port number that are used by the service proxies
- The port number assigned to each name can vary in each backend pod.
- That is, without breaking clients, it is possible to update the port number that pods expose in the coming version of the backend software.
- Optional service mapping of incoming ports to a targetPort.
- By default, the targetPort is set to the port field’s same value. targetPort can be defined as a string.
- Services can be defined with or without pod selectors.
- For example, to point a service to another service in a different namespace or cluster.
- Services support TCP (default), UDP and SCTP for protocols.