Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker for Desktop runs the Kubernetes - Ip address is not working

kubectl describe node docker-for-desktop This gets the IP address of Docker desktop for Windows.

But we run it on browser with ip:nodeport it is not working.

nodeport - is the port number that we mention in the services file of kubernetes cluster.

Please find myservice.yaml file in the code section.

apiVersion: v1
kind: Service
metadata:
  name: xxxx

spec:
  # This defines which pods are going to be represented by this Service
  # The service becomes a network endpoint for either other services
  # or maybe external users to connect to (eg browser)
  selector:
    mykey: webapp
    release: "0-5"

  ports:
    - name: http
      port: 80
      nodePort: 30080
      #this is port number greater than 30000, and it is port of the Node where this cluster is present.

  type: NodePort

http://<dockerDesktopIdaddress>:<nodeport>

nodeport is the port number in the service file of kubernetes cluster.

always gives error.

like image 900
Rajasekar Murugesan Avatar asked Jul 13 '19 18:07

Rajasekar Murugesan


People also ask

How does Docker desktop run Kubernetes?

Docker Desktop includes a standalone Kubernetes server and client, as well as Docker CLI integration that runs on your machine. The Kubernetes server runs locally within your Docker instance, is not configurable, and is a single-node cluster.

How do I get the IP address for Kubernetes service?

To find the cluster IP address of a Kubernetes pod, use the kubectl get pod command on your local machine, with the option -o wide . This option will list more information, including the node the pod resides on, and the pod's cluster IP. The IP column will contain the internal cluster IP address for each pod.

How do I find my Docker desktop IP address?

By default, the container is assigned an IP address for every Docker network it connects to. And each network is created with a default subnet mask, using it as a pool later on to give away the IP addresses. Usually Docker uses the default 172.17. 0.0/16 subnet for container networking.

Does Docker desktop include kubectl?

Kubernetes uses a different tool called kubectl to manage apps - Docker Desktop installs kubectl for you too. You should see a single node in the output called docker-desktop . That's a full Kubernetes cluster, with a single node that runs the Kubernetes API and your own applications.


1 Answers

I had the same issue and the resolution was simple. curl localhost:$NODE_PORT

Docker for Mac runs on the same host and you can call the service through localhost.

like image 142
Chanaka udaya Avatar answered Oct 20 '22 05:10

Chanaka udaya