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 <pending>.
  • 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
      name: registry-ingress
      namespace: registry
        nginx.ingress.kubernetes.io/rewrite-target: /
      - http:
          - path: /registry
              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?

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.