<p>Can you help me? I want to deploy Ingres for nodeport. But I can't understand if this possible? </p>

<p>I tried to find some information in Google but I got Ingress for load balancing or some difficult examples Ingress Ruby on rails and etc. </p>

noute
<p>Create deployment and service</p>
<pre><code>kubectl create deploy test --image httpd
kubectl expose deploy test --port 80 --target-port 80
</code></pre>
<p>Check if the service is working</p>
<pre><code>kubectl get svc
</code></pre>
<p>returns</p>
<pre><code>NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
test         ClusterIP   11.105.18.110   &lt;none&gt;        80/TCP    51s
</code></pre>
<p>Then</p>
<pre><code>curl 11.105.18.110:80
</code></pre>
<p>returns</p>
<pre><code>&lt;html&gt;&lt;body&gt;&lt;h1&gt;It works!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>
<p>Create bare-metal ingress controller</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.0/deploy/static/provider/baremetal/deploy.yaml
</code></pre>
<p><a href="https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal</a></p>
<p>This returns</p>
<pre><code>namespace/ingress-nginx unchanged
serviceaccount/ingress-nginx unchanged
configmap/ingress-nginx-controller configured
clusterrole.rbac.authorization.k8s.io/ingress-nginx unchanged
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx unchanged
role.rbac.authorization.k8s.io/ingress-nginx unchanged
rolebinding.rbac.authorization.k8s.io/ingress-nginx unchanged
service/ingress-nginx-controller-admission created
service/ingress-nginx-controller created
deployment.apps/ingress-nginx-controller created
ingressclass.networking.k8s.io/nginx unchanged
validatingwebhookconfiguration.admissionregistration.k8s.io/ingress-nginx-admission configured
serviceaccount/ingress-nginx-admission unchanged
clusterrole.rbac.authorization.k8s.io/ingress-nginx-admission unchanged
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx-admission unchanged
role.rbac.authorization.k8s.io/ingress-nginx-admission unchanged
rolebinding.rbac.authorization.k8s.io/ingress-nginx-admission unchanged
job.batch/ingress-nginx-admission-create created
job.batch/ingress-nginx-admission-patch created
</code></pre>
<p>Create ingress rules for nginx controller</p>
<pre><code>kubectl apply -f -&lt;&lt;EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test
  annotations:
    kubernetes.io/ingress.class: nginx  
spec:
  rules:
  - http:
      paths:
      - backend:
          service:
            name: test
            port:
              number: 80
        path: /
        pathType: Prefix
EOF
</code></pre>
<p><strong>Annotation &quot;kubernetes.io/ingress.class: nginx&quot; is required to bind Ingress to the controller</strong></p>
<p><a href="https://www.fairwinds.com/blog/intro-to-kubernetes-ingress-set-up-nginx-ingress-in-kubernetes-bare-metal" rel="nofollow noreferrer">https://www.fairwinds.com/blog/intro-to-kubernetes-ingress-set-up-nginx-ingress-in-kubernetes-bare-metal</a></p>
<p>Get nodes ips</p>
<pre><code>kubectl get no -o wide

NAME    STATUS   ROLES                  AGE     VERSION   INTERNAL-IP   
master  Ready    control-plane,master   6d20h   v1.21.0   134.156.0.81   
node1   Ready    &lt;none&gt;                 5d      v1.21.0   134.156.0.82   
node2   Ready    &lt;none&gt;                 6d19h   v1.21.0   134.156.0.83   
node3   Ready    &lt;none&gt;                 6d19h   v1.21.0   134.156.0.84  
</code></pre>
<p>Find ingress controller nodeport</p>
<pre><code>kubectl get svc -n ingress-nginx 

NAME                                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller             NodePort    15.234.89.16    &lt;none&gt;        80:31505/TCP,443:32191/TCP   21m
</code></pre>
<p>Its 31505. Access test service over ingress node port on one of your nodes, for example on node1 134.156.0.82</p>
<pre><code>curl 134.156.0.82:31505
</code></pre>
<p>returns</p>
<pre><code>&lt;html&gt;&lt;body&gt;&lt;h1&gt;It works!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>
<p>This was tested on Google Cloud virtual machines but without GKE</p>
