<p>First of all, what I want to build is right below.
<a href="https://i.stack.imgur.com/b5yKz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b5yKz.png" alt="enter image description here" /></a></p>
<p>as above diagram, I want Ingress to make distribute traffics to service which is at other namespace <code>me</code> in same cluster. (Ingress is in <code>main</code> namespace) But the Ingress doesn't allow to point dns directly, I make ExternalName Service that points to <code>me-service</code> dns <code>me-service.me.svc.cluster.local</code> and then Ingress points to it.</p>
<p>Yaml of it is</p>
<p>main.k8s.yaml</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Namespace
metadata:
  name: main
---
apiVersion: v1
kind: Service
metadata:
  name: me-service
  namespace: main
spec:
  externalName: me-service.me.svc.cluster.local
  type: ExternalName
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: gce
  name: main-router
  namespace: main
spec:
  rules:
  - host: some-domain.me
    http:
      paths:
      - backend:
          service:
            name: me-service
            port:
              number: 80
        path: /
        pathType: ImplementationSpecific

</code></pre>
<p>me.k8s.yaml</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Namespace
metadata:
  labels:
    stag: production
  name: me
---
apiVersion: v1
kind: Service  # &lt;-- this is the service I want to point
metadata:
  labels:
    app: me
    stag: production
  name: me-service
  namespace: me
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: me
    stag: production
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: me
    stag: production
  name: me-deployment
  namespace: me
spec:
  replicas: 2
  selector:
    matchLabels:
      app: me
      stag: production
  template:
    metadata:
      labels:
        app: me
        stag: production
    spec:
      containers:
      - image: gcr.io/me:latest
        name: me
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: 300m
            memory: 512M
          requests:
            cpu: 250m
            memory: 512M

</code></pre>
<p>And I checked dns address works but Ingress object doesn't created with error message</p>
<pre><code>me-service:80 (&lt;error: endpoints &quot;me-service&quot; not found&gt;)
 Type     Reason     Age                    From                     Message
  ----     ------     ----                   ----                     -------
  Warning  Translate  6m21s (x233 over 22h)  loadbalancer-controller  Translation failed: invalid ingress spec: could not find port &quot;80&quot; in service &quot;main/me-service&quot;
</code></pre>
<p>How can I make ingress work? If you need more information, please let me know. :pray:</p>
<p>GKE Engine: <strong>1.20.6-gke.1000</strong></p>
<p>HTTP Load Balancing: <strong>Enabled</strong></p>
<p>Network policy: <strong>Disabled</strong></p>
<p>Dataplane V2: <strong>Enabled</strong></p>

HyeonJunOh
<p><em>I'm posting it as an answer for better visibility. As I already mentioned in my comments:</em></p>
<p>As far as I know you cannot use <strong>GKE ingress</strong> with <code>ExternalName</code> Service type. The two supported types are <code>LoadBalancer</code> and <code>NodePort</code>. If nothing changed recently, you shouldn't be able to create an ingress resource even with a simple <code>ClusterIP</code>, only two above mentioned svc types so I don't believe that <code>ExternalName</code> would work. Well, you can actually use <code>ClusterIP</code> but only if you use <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/container-native-load-balancing" rel="nofollow noreferrer">container native load balancing</a> which requires your <strong>GKE</strong> cluster to be VPC-native.</p>
<p>You can still use <strong>GKE</strong> but you don't have to use <strong>GCE ingress</strong> as an ingress controller at the same time. But I would try first if it doesn't work with the mentioned container-native load balancing.</p>
<p>You can always deploy <strong>different ingress controller on your <strong>GKE</strong> cluster e.g. nginx-ingress</strong>. It can use <code>ClusterIP</code> services out of the box, but I'm not sure if it can handle the <code>ExternalName</code> so you would have to try this out.</p>
<p>OP confirmed that with <strong>nginx-ingress</strong> it was possible to distribute traffic to services located in different namespaces:</p>
<blockquote>
<p>@mario Thank you for your comment. I successfully distribute traffics
to other namespace svc using NGINX-ingress. – HyeonJunOh Jul 23 at
9:23</p>
</blockquote>
