What does kubernetes do under the hoods with containerPort?

When we create a redis instance, we specify 6379. Docker image of redis is already configured to listen to 6379. I am interested to know what Kubernetes does with the containerPort information.

Hello @rasivasu,

  1. To expose PODs to the external world.
  2. You can load balance between a set of pods and get rid of pod IP change if it dies.
    To expose a pod to the external world you need to create a service with nodePort type. nodePort sends external traffic to the Kubernetes cluster which is received on β€œport” defined in service object YAML.
    Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default β€œ0.0.0.0” address inside a container will be accessible from the network. Cannot be updated.
    to get more info use ckeck the following link:
1 Like