skip to Main Content

I have 1 master and 2 worker on my k8s cluster.It’s bare metal and I can’t use any of cloud providers. I just can use DNS load balancer. I want to expose valid ports (like 80 and 443) on my nodes because of that I can’t use NodePort. What is the best solution?

My only solution was to install Nginx on all of my nodes and proxy ports to my ClusterIp services.I don’t know that this is a good solution or not.

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution. I need to edit /etc/kubernetes/manifests/kube-apiserver.yaml and edit service-node-port-range to 80 to any number that I want. Then declare my ingress service as nodePort.


  2. Following things that you are doing right :

    1. Cluster IP service – If you don’t want to expose your services to be invoked form outside the cluster, CLusterIP is right way instead of NodePort or LoadBalancer.

    Following things that you can do:

    1. Create an Ingress Controller and and Ingress resource for your cluster which will listen on port 80 and 443 and proxy the requests to your services according to routes mentioned in the ingress.
    2. You can create inginx-ingress controller using link: https://kubernetes.github.io/ingress-nginx/deploy/
    3. Then create an Ingress resource using link https://kubernetes.io/docs/concepts/services-networking/ingress/
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search