<p>I started working with kubernetes few months ago, i create services and replicaset for differents backends applications.</p>

<p>Now i want use ingress service to access my differents applications from external with my domain name. As it's not in production yet and i use just on node i don't want use loadbalancer.</p>

<p>It is possible to set Service with NodePort and attach it to an Ingress without use loadbalancer?</p>

<p>This is my configuration: </p>

<pre><code>kind: Service
metadata:
  name: nginx-replicaset-service
  labels:
    app: nginx-demo
spec:
  externalIPs:
    - XXX.XXX.XXX.XXX
  selector:
    app: nginx-replica
  type: NodePort
  ports:
    - name: http
      port: 80
</code></pre>

<pre><code>kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
    - host: www.mydomain.com
      http:
        paths:
          - path: /
            backend:
              serviceName: nginx-replicaset-service
              servicePort: 80
    - host: test.mydomain.com
      http:
        paths:
          - path: /test
            backend:
              serviceName: other-service
              servicePort: 80
</code></pre>

<p>When i check the ingress information on my cluster i have the following: </p>

<pre><code>NAME         HOSTS                                   ADDRESS   PORTS   AGE
my-ingress   www.mydomain.com,test.mydomain.com                80      4d22h
</code></pre>

<p>Address always empty</p>

<p>If your cluster is running on GCP or GKE you can </p>

<p>1) create a global IP address</p>

<pre><code>gcloud compute addresses create ingress-static-ip --global
</code></pre>

<p>2) set the <strong>kubernetes.io/ingress.global-static-ip-name</strong> annotation on the Ingress config</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: ingress-static-ip
  labels:
    app: nginx-replica
</code></pre>

<p>3) And a service</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx-replicaset-service
  labels:
    app: nginx-demo
spec:
  selector:
    app: nginx-replica
  type: NodePort
  ports:
    - name: http
      port: 80
</code></pre>

<p><a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip</a></p>
