<p>I have a bare-metal kubernetes cluster. I applied the kubernetes nginx deployment like this:
kubectl apply -f <a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/baremetal/deploy.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.34.1/deploy/static/provider/baremetal/deploy.yaml</a></p>
<p>and added this ingress resource:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
spec:
  externalTrafficPolicy: Local
  selector:
    app: ingress-nginx
    name: ingress-nginx
  type: NodePort
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: https
</code></pre>
<p>And my ingress resource:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
spec:
  rules:
    - host: ** master hostname **
      http:
        paths:
          - path: /rest/endpoints/hello
            backend:
              serviceName: microservices-service
              servicePort: 8085
          - path: /rest/endpoints/calculateIterationTotalCapcity
            backend:
              serviceName: microservices-service
              servicePort: 8085
</code></pre>
<p>But still I can't access my master on port 80.
Can you please help?
Thanks in advance.</p>

Yaakov Shami
<p>From attached information we can see that your service definition is improper due to:</p>
<pre><code>selector:
    app: ingress-nginx
</code></pre>
<p>As you can see in the original service definition for <a href="https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal" rel="nofollow noreferrer">Bare-metal installation using NodePort</a> it should looks like:</p>
<pre><code>spec:
  type: NodePort
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: controller
</code></pre>
<p>Note:</p>
<blockquote>
<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#service-resource" rel="nofollow noreferrer">Service resources</a> - In Kubernetes, a Service is an abstraction which defines a logical set of Pods and a policy by which to access them (sometimes this pattern is called a micro-service). The set of Pods targeted by a Service is usually determined by a selector</p>
</blockquote>
<p>In this situation your service probably doesn't have proper endpoints, so my advice is to redeploy your nginx-ingress controller according to the <a href="https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal" rel="nofollow noreferrer">official docs</a>.</p>
<p>Depending on your needs you can expose your controller over:</p>
<ul>
<li><a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#over-a-nodeport-service" rel="nofollow noreferrer">NodePort Service</a></li>
<li><a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network" rel="nofollow noreferrer">via the host network</a> as stated by <a href="https://stackoverflow.com/a/63465295/11207414">Arghya Sadhu</a></li>
</ul>
<p>Note:</p>
<blockquote>
<p>Enabling this option exposes every system daemon to the NGINX Ingress controller on any network interface, including the host's loopback. Please evaluate the impact this may have on the security of your system carefully.</p>
</blockquote>
<ul>
<li>expose as <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#a-pure-software-solution-metallb" rel="nofollow noreferrer">LoadBalancer service</a>
using <a href="https://metallb.universe.tf/" rel="nofollow noreferrer">MetalLB</a> - &quot;<em>load-balancer implementation for bare metal Kubernetes clusters</em>&quot;</li>
</ul>
<p>Once your ingress-controller will be working properly you can go through:</p>
<ul>
<li><a href="https://kubernetes.github.io/ingress-nginx/user-guide/basic-usage/#basic-usage-host-based-routing" rel="nofollow noreferrer">Basic usage - host based routing</a></li>
<li><a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress</a></li>
<li><a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class" rel="nofollow noreferrer">Ingress Class</a></li>
</ul>
<p>Note:</p>
<blockquote>
<p>Caution: If you have more than one IngressClass marked as the default for your cluster, the admission controller prevents creating new Ingress objects that don't have an IngressClassName specified. You can resolve this by ensuring that at most 1 IngressClasses are marked as default in your cluster</p>
</blockquote>
