Expose kubernetes deployment on master's IP I have simple deployment which has 3 replicas. I want this deployment to be load balanced between this 3 replicas, but available under IP of my master and on some specified port.

This cluster was created by using kubeadm, I have one master and 20 worker nodes.


I tried to expose the service as LoadBalancer, but this only works when you have cloud load balancer configured. I don't have such thing and EXTERNAL-IP is always &lt;pending&gt;.
I tried to expose the service as NodePort, but this only works on nodes where pods were created. So for example after rollout, when pods will be created on different nodes, it will stop working. Also I guess this is not load balanced properly.
I tried to create ingress to make it work, but unsuccessfully.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: registry-ingress
  namespace: registry
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
    paths:
      - path: /registry
        backend:
          serviceName: registry-service
          servicePort: 5000



What is the proper approach here?



If the above is possible then second question: is it possible to expose it on 2 masters if I will want to create 2nd one?
I was wrong about the NodePort approach. It was firewall blocking the connection to my master on ports 30000-32767.

After unblocking this ports everything was working fine with NodePort service.