i have a handful of dockerized microservices, each is listening for http requests on a certain port, and i have these deployments formalized as kubernetes yaml files
however, i can't figure out a working strategy to expose my deployments on the interwebs (in terms of kubernetes services)
each deployment has multiple replicas, and so i assume each deployment should have a matching load balancer service to expose it to the outside
now i can't figure out a strategy to sanely expose these microservices to the internet... here's what i'm thinking:
the whole cluster is exposed on a domain name, and services are subdomains
- say the cluster is available at
k8s.mydomain.com
- each loadbalancer service (which exposes a corresponding microservice) should be accessible by a subdomain
auth-server.k8s.mydomain.com
profile-server.k8s.mydomain.com
questions-board.k8s.mydomain.com
- so requests to each subdomain would be load balanced to the replicas of the matching deployment
- so how do i actually achieve this setup? is this desirable?
- can i expose each load balancer as a subdomain? is this done automatically?
- or do i need an ingress controller?
- am i barking up the wrong tree?
- i'm looking for general advice on how to expose a single app which is a mosaic of microservices
- say the cluster is available at
each service is exposed on the same ip/domain, but each gets its own port
- perhaps the whole cluster is accessible at
k8s.mydomain.com
again - can i map each port to a different load balancer?
k8s.mydomain.com:8000
maps toauth-server-loadbalancer
k8s.mydomain.com:8001
maps toprofile-server-loadbalancer
- is this possible? it seems less robust and less desirable than strategy 1 above
- perhaps the whole cluster is accessible at
each service is exposed on its own ip/domain?
- perhaps each service specifies a static ip, and my domain has A records pointing each subdomain at each of these ip's in a manual way?
- how do i know which static ip's to use? in production? in local dev?
maybe i'm conceptualizing this wrong? can a whole kubernetes cluster map to one ip/domain?
what's the simplest way to expose a bunch of microservies in kubernetes? on the other hand, what's the most robust/ideal way to expose microservices in production? do i need a different strategy for local development in minikube? (i was just going to edit /etc/hosts
a lot)
thanks for any advice, cheers