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.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With