title: Google Kubernetes Engine: How to define one Ingress for multiple namespaces?
body: <p>On GKE, K8s Ingress are LoadBalancers provided by Compute Engine which have some cost. Example for 2 months I payed 16.97€. </p>
  
  <p>In my cluster I have 3 namespaces (<code>default</code>, <code>dev</code> and <code>prod</code>) so to reduce cost I would like to avoid spawning 3 LoadBalancers. The question is how to configure the current one to point to the right namespace?</p>
  
  <p>GKE requires the ingress's target Service to be of type <code>NodePort</code>, I am stuck because of that constraint.</p>
  
  <p>I would like to do something like:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
   namespace: dev
   annotations: # activation certificat ssl
     kubernetes.io/ingress.global-static-ip-name: lb-ip-adress     
  spec:
   hosts:
      - host: dev.domain.com 
        http:
          paths:
            - path: /*
              backend:
                serviceName: dev-service # This is the current case, 'dev-service' is a NodePort
                servicePort: http
  
      - host: domain.com 
        http:
          paths:
            - path: /*
              backend:
                serviceName: prod-service # This service lives in 'dev' namespace and is of type ExternalName. Its final purpose is to point to the real target service living in 'prod' namespace.
                servicePort: http
  
      - host: www.domain.com 
        http:
          paths:
            - path: /* 
              backend:
                serviceName: prod-service
                servicePort: http
  </code></pre>
  
  <p>As GKE requires service to be <code>NodePort</code> I am stuck with <code>prod-service</code>.</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>Thanks a lot</p>