<p>I have used the following configurations to deploy an app on minikube.</p>
<p><strong>Deployment</strong>:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: angular-app
spec:
  replicas: 2
  selector:
    matchLabels:
      run: angular-app
  template:
    metadata:
      labels:
        run: angular-app
    spec:
      containers:
      - name: angular-app
        image: nheidloff/angular-app
        ports:
        - containerPort: 80
        - containerPort: 443
    
</code></pre>
<p><strong>Service:</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: angular-app
  labels:
    run: angular-app
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
</code></pre>
<p><strong>Service description:</strong></p>
<pre><code>Name:                     angular-app    
Namespace:                default        
Labels:                   run=angular-app
Annotations:              &lt;none&gt;
Selector:                 &lt;none&gt;
Type:                     NodePort       
IP Family Policy:         SingleStack    
IP Families:              IPv4
IP:                       10.102.174.98  
IPs:                      10.102.174.98
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  31503/TCP
Endpoints:                172.17.0.3:80,172.17.0.4:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   &lt;none&gt;
</code></pre>
<p>When i try to access the endpoints, the links are not responding. However after using <code>minikube service angular-app</code>. Following showed up:</p>
<pre><code>|-----------|-------------|-------------|---------------------------|
| NAMESPACE |    NAME     | TARGET PORT |            URL            |
|-----------|-------------|-------------|---------------------------|
| default   | angular-app | http/80     | http://192.168.49.2:31503 |
|-----------|-------------|-------------|---------------------------|
🏃  Starting tunnel for service angular-app.
|-----------|-------------|-------------|------------------------|
| NAMESPACE |    NAME     | TARGET PORT |          URL           |
|-----------|-------------|-------------|------------------------|
| default   | angular-app |             | http://127.0.0.1:60611 |
|-----------|-------------|-------------|------------------------|
</code></pre>
<p>With this ip <code>http://127.0.0.1:60611</code> im able to access the app. What is the use of the endpoints given in the service description? How to access each replica? Say if i have 4 replicas, how do i access each one of them?</p>

swaran
<ul>
<li><p>The endpoints provided in the service description are the endpoints for each of the pods <code>172.17.0.3:80,172.17.0.4:80</code>, when you deploy more replicas you will have more endpoints.</p>
</li>
<li><p>The angular-app service is bonded to port number <code>31503</code> and you can access your service on this port from cluster nodes (not your host machine).</p>
</li>
<li><p><code>minikube service angular-app</code> will create a tunnel between your host machine and the cluster nodes on port <code>60611</code>. This means anything that comes on <code>127.0.0.1:60611</code> will be redirected to <code>192.168.49.2:31503</code> and then one of the available endpoints.</p>
</li>
<li><p>The service will take care of balancing the load between all replicas automatically and you don't need to worry about it.</p>
</li>
<li><p>if you would like to access a specific pod you can use the below command:</p>
</li>
</ul>
<pre><code>kubectl port-forward ${POD_NAME} 80:80
</code></pre>
<p>you need to replace the pod name from the above command and the command assumes that port <code>80</code> is available on your machine.</p>
