Introducing the Kubernetes service
Kubernetes deployments create and destroy pods dynamically. For a general three-tier web architecture, this can be a problem if the frontend and backend are different pods. Frontend pods don't know how to connect to the backend. Network service abstraction in Kubernetes resolves this problem.
The Kubernetes service enables network access for a logical set of pods. The logical set of pods are usually defined using labels. When a network request is made for a service, it selects all the pods with a given label and forwards the network request to one of the selected pods.
A Kubernetes service is defined using a YAML Ain't Markup Language (YAML) file, as follows:
apiVersion: v1 kind: Service metadata:   name: service-1 spec:   type: NodePort   selector:     app: app-1   ports:     - nodePort: 29763       protocol: TCP  ...