Can I use both TCP and HTTP load balancers with the same Kubernetes pods?

0
19
Asked By CuriousCoder99 On

I'm working on an application that handles both TCP/TLS connections and HTTP requests. For my setup, I need to terminate SSL at the instance due to how we manage certificates and authentication. I've set up a Managed Instance Group (MIG) in GCP with both a TCP pass-through load balancer and an HTTP(s) load balancer. However, I'm running into an issue since I'm not allowed to direct both the TCP and HTTP load balancer to the same MIG. Now I'm curious if Kubernetes (GKE) allows for both a TCP and HTTP load balancer to point to the same pods, albeit on different ports. I require the TLS connection to be terminated at the instance, not at the load balancer. Is this setup feasible in Kubernetes?

4 Answers

Answered By TechieTim43 On

Load balancers in GCP are strictly TCP or UDP. Since HTTP(S) is based on TCP, you'll need to set up a dedicated TCP load balancer for your non-HTTP traffic and a separate HTTP load balancer for your web traffic. If you're using Kubernetes, make sure to define this in your service configuration, as it can handle multiple ports.

Answered By DevDude28 On

Absolutely, in Kubernetes, you can define services that expose multiple ports. Just configure one service for the TCP traffic (with pass-through for TLS termination on your instance) and another service for the HTTP traffic (which would terminate HTTPS and handle all your certificates). It sounds like your previous setup in GCP with the managed instance groups wasn't aligned with this capability.

Answered By CodedInMySleep44 On

Just keep in mind, TCP operates at layer 4 while HTTP operates at layer 7. They're different types of load balancers. If you're thinking about how to set them up, just focus on what each one is designed to handle.

Answered By CloudNinja77 On

Considering GKE, yes, it should work. If you're using Ingress in Kubernetes, it can handle the HTTP(S) requests while you configure a separate service for TCP. Just ensure you're clearly defining the ports and services in your deployment.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.