Best way to connect external client directly to pod on a range of ports? #129
-
A customer asked:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is generally handled by a The disadvantage of If neither of those work, then typically you rely on a custom networking system for the Pods by implementing or deploying a CNI that allows you to allocate connectable IP addresses to the Pods. For example, in EKS, this is handled by using the VPC CNI which allocates IP addresses from the VPC to the Pods, which allow any service in the VPC to directly connect to the Pod’s IP. You will have to find what CNI options exist which will allow you to have a similar benefit in your data center. |
Beta Was this translation helpful? Give feedback.
-
Credit for this solution goes to @yorinasub17 |
Beta Was this translation helpful? Give feedback.
This is generally handled by a
Service
orIngress
, depending on the type of application and how you are connecting to it. The easiest would be to use aNodePort
typeService
(which is better than usinghostNetworking
with the container because the container doesn’t have to have privileged access). This is best described in the blog post https://dzone.com/articles/kubernetes-exposing-services.The disadvantage of
NodePort
is that there is only a finite number of ports you can expose, which can easily run out depending on how many pods you want to expose. The next general approach is to use Ingress. The idea of Ingress is to run a load balancer application in your cluster which manages the …