Home > Back-end >  Kubernetes NodePort url getting changed with "minikube service <service>"
Kubernetes NodePort url getting changed with "minikube service <service>"

Time:10-06

I have created a NodePort to forward request from port 30101->80->8089:

apiVersion: v1
kind: Service
metadata:
  name: gorest-service
spec:
  type: NodePort
  selector:
    app: gorest
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8089
      nodePort: 30101

When I try to get the service URL http://192.168.49.2:30101, I am unable to access it, but with url http://127.0.0.1:64741, retrieved by using minikube service <service>, I am able to access.

Query: Unable to understand how http://192.168.49.2:30101 was changed to http://127.0.0.1:64741 retrived by minikube service <service>

 % minikube service gorest-service
|-----------|----------------|-------------|---------------------------|
| NAMESPACE |      NAME      | TARGET PORT |            URL            |
|-----------|----------------|-------------|---------------------------|
| default   | gorest-service |        8089 | http://192.168.49.2:30101 |
|-----------|----------------|-------------|---------------------------|
           
  • Related