How to Route to specific pod through Kubernetes Service (like a Gateway API)

后端 未结 3 1298
情话喂你
情话喂你 2021-01-05 07:05

I am running Kubernetes on \"Docker Desktop\" in Windows.

I have a LoadBalancer Service for a deployment which has 3 replicas. I would like to access SPECIFIC pod th

3条回答
  •  时光说笑
    2021-01-05 07:36

    IMO, the only way to achieve this will be:

    1. Instead of using a deployment with 3 replicas, use 3 deployments with 1 replicas each (or just create pods only); deployment1 -> pod1, deployment2 -> pod2, deployment3 -> pod3
    2. Expose all the deployments on a separate service, service1 -> deployment1, service2 -> deployment2, service3 -> deployment3
    3. Create an ingress resource and route to each pod using the service for each deployment. For example:
      • ingress-url/service1
      • ingress-url/service2
      • ingress-url/service3

提交回复
热议问题