<p>After reading thru Kubernetes documents like this, <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="noreferrer">deployment</a> , <a href="https://kubernetes.io/docs/concepts/services-networking/service/#motivation" rel="noreferrer">service</a> and <a href="https://www.digitalocean.com/community/tutorials/an-introduction-to-kubernetes" rel="noreferrer">this</a> I still do not have a clear idea what the purpose of service is. </p>

<p>It seems that the service is used for 2 purposes:</p>

<ol>
<li>expose the deployment to the outside world (e.g using LoadBalancer),  </li>
<li>expose one deployment to another deployment (e.g. using ClusterIP services). </li>
</ol>

<p>Is this the case? And what about the Ingress?</p>

<p>------ update ------</p>

<p><a href="https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/" rel="noreferrer">Connect a Front End to a Back End Using a Service</a> is a good example of the service working with the deployment.</p>

<p><strong>Service</strong></p>

<p>A deployment consists of one or more pods and replicas of pods. Let's say, we have 3 replicas of pods running in a deployment. Now let's assume there is no service. How does other pods in the cluster access these pods? Through IP addresses of these pods. What happens if we say one of the pods goes down. Kunernetes bring up another pod. Now the IP address list of these pods changes and all the other pods need to keep track of the same. The same is the case when there is auto scaling enabled. The number of the pods increases or decreases based on demand. To avoid this problem services come into play. Thus services are basically programs that manages the list of the pods ip for a deployment. </p>

<p>And yes, also regarding the uses that you posted in the question.</p>

<p><strong>Ingress</strong></p>

<p>Ingress is something that is used for providing a single point of entry for the various services in your cluster. Let's take a simple scenario. In your cluster there are two services. One for the web app and another for documentation service. If you are using services alone and not ingress, you need to maintain two load balancers. This might cost more as well. To avoid this, ingress when defined, sits on top of services and routes to services based on the rules and path defined in the ingress. </p>
