Kubernetes service for pod with hostnetworking

12/8/2021

I've a pod with hostnetworking enabled. The host has multiple interfaces like eth0,eth1,eth2,lo. Now when I configure service with type clusterIP and selector "app:my-app" , what will be the endpoints associated with svc? I see it's selecting the IP associated with eth0(this network is part of kubernetes subnet). Is there a way to tell the service to pick IP associated with any particular interface?

-- Tardigrade
kubernetes
kubernetes-service

1 Answer

12/8/2021
  • kubectl get endpoints will show available endpoints for services
  • we can edit the endpoint directly with ip address of any particular interface
     1.  kubectl edit endpoints <svcname>
     2.  change the `ip` field with the desired eth interface ip address.
-- confused genius
Source: StackOverflow