Minikube: unable to connect locally deployed nginx service

I installed a mini cube on my ubuntu 16.04 computer and started a cluster with the message

"Kubernetes is available at https://192.168.99.100:443"

Then I deployed the nginx service with the following command

> kubectl.sh run my-nginx --image=nginx --replicas=2 --port=80 --expose

 > kubectl.sh get pods -o wide NAME READY STATUS RESTARTS AGE NODE my-nginx-2494149703-8jnh4 1/1 Running 0 13m 127.0.0.1 my-nginx-2494149703-q09be 1/1 Running 0 13m 127.0.0.1 > kubectl.sh get services -o wide NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR kubernetes 10.0.0.1 <none> 443/TCP 14m <none> my-nginx 10.0.0.83 <none> 80/TCP 13m run=my-nginx > kubectl.sh get nodes -o wide NAME STATUS AGE 127.0.0.1 Ready 16m 

Questions:

1) Is node 127.0.0.1 my local development machine? This confused me the most.

2) I correctly understand the following: the cluster (nodes, API server of the kubernetes) has internal IP addresses at 10.0.0.x, and their corresponding external IP addresses are 192.168.99.x. Then 2 containers will have IP addresses in the range of 10.0.1.x and 10.0.2.x?

3) Why does the external IP for services not exist? Even for the Kubernett service. Isn't it a 192.168.99.43 external IP?

4) Most importantly, how do I connect to the nginx service from my laptop?

+5
source share
1 answer

1) Is node 127.0.0.1 my local development machine? It bothered me that confused me the most.

When a node registers, you provide an IP address or name for registration. By default, node simply logs 127.0.0.1 . This applies to your Linux virtual machine, not your host machine.

2) Is my following understanding correct: the cluster (nodes, kubernetes API server) has internal IP addresses at 10.0.0.x and their corresponding external IP addresses is 192.168.99.x. The 2 pods will then be IP addresses in the range of 10.0.1.x and 10.0.2.x?

Yup, network 10.0.0.x is your overlay network. 192.168.99.x are your "public" addresses that are visible outside the cluster.

3) Why does the external IP for services not exist? Not even for serving cubernets. Isn't it a 192.168.99.43 external IP?

An external IP is typically used to enter traffic through a specific IP address. The kubernetes service uses the clusterIP service type, which means that it is available only to the internal cluster.

4) Most importantly, how do I connect to the nginx service from my laptop?

The easiest way to view your nginx service is to enter NodePort and then deploy the service. After that, describe the service to get the port that was assigned (or after you create it, they will also tell you). Then click the ip of your virtual machine and provide the automatically assigned NodePort.

eg http://192.168.99.100:30001

+9
source

All Articles