Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the colon mean in the list of ports when running kubectl get services

If I run kubectl get services for a simple demo service I get the following response:

NAME           TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
demo-service   LoadBalancer   10.104.48.115   <pending>     80:32264/TCP   18m

What does the : mean in the port list?

like image 328
tophatsteve Avatar asked Sep 13 '19 07:09

tophatsteve


People also ask

What ports does Kubernetes run?

The ports required for a Kubernetes deployment are: 2379/tcp: Kubernetes etcd server client API (on master nodes in multi-master deployments) 2380/tcp: Kubernetes etcd server client API (on master nodes in multi-master deployments) 6443/tcp: Kubernetes API server (master nodes)

How ports work in Kubernetes?

Port exposes the Kubernetes service on the specified port within the cluster. Other pods within the cluster can communicate with this server on the specified port. TargetPort is the port on which the service will send requests to, that your pod will be listening on.

How does Kubernetes check ports of pods?

shell into the pod and try running netstat -tulpn gives you all the ports open.


3 Answers

External access to the demo-service will happen via port 32264, which connects to port 80 on the docker container.

like image 136
Blokje5 Avatar answered Oct 07 '22 10:10

Blokje5


Meaning 80:32264/TCP this is,

You have demo-service and it is pointing 80 port to your pod and 32264/TCP means you can use NodeIP for accessing the application which is running in pod from external network (outside of cluster). And the : will separate these ports for your understanding which is external and internal port for accessing pod.

like image 41
Sachin Arote Avatar answered Oct 07 '22 11:10

Sachin Arote


This means that your service demo-service can be reached on port 80 from other containers and on the NodePort 32264 from the "outer" world.

In this particular case it will be accessed by Load Balancer which is provisioned/managed by some sort of Kubernetes controller.

like image 36
Stepan Vrany Avatar answered Oct 07 '22 10:10

Stepan Vrany