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?
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)
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.
shell into the pod and try running netstat -tulpn gives you all the ports open.
External access to the demo-service will happen via port 32264, which connects to port 80 on the docker container.
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.
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.
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