<p>I have an ingress pod deployed with Scaleway on a Kubernetes cluster and it exists in the kube-system namespace. I accidentally created a load balancer service on the <code>default</code> namespace and I don't want to delete and recreate it a new one on the <code>kube-system</code> namespace so I want my Load balancer in the <code>default</code> namespace to have the ingress pods as endpoints:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ecom-loadbalancer
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  ports:
    - port: 443
      targetPort: 443
  type: LoadBalancer
</code></pre>
<p>Is that possible? Is there something I should add in the selector fields?</p>
<hr />
<p>I tried creating a <code>clusterIP</code> service in the <code>kube-system</code> namespace that communicates with the ingress pods, it worked.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ecom-loadbalancer
  namespace: kube-system
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  ports:
    - port: 443
      targetPort: 443
  type: ClusterIP
</code></pre>
<p>Then, I tried referencing that service to my <code>loadbalancer</code> in the default namespace like that:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ecom-loadbalancer
spec:
  type: ExternalName
  externalName: ecom-loadbalancer.kube-system.svc.cluster.local
  ports:
    - port: 443
      targetPort: 443
  type: LoadBalancer
</code></pre>
<p>But no result. The <code>clusterIP</code> points to the Ingress pods, but the load balancer remains without endpoints.</p>

joe1531
<p>At least three reasons why you need to re-create it properly (2 technical and advice):</p>
<ol>
<li><p><code>ExternalName</code> is used for accessing external services or services in other namespaces. The way it works is when looking up the service's name happens, CNAME will be returned. So in other words it works for egress connections when requests should be directed somewhere else.</p>
<p>See <a href="https://kubernetes.io/docs/concepts/services-networking/service/#externalname" rel="nofollow noreferrer">service - externalname type</a> and use cases <a href="https://akomljen.com/kubernetes-tips-part-1/" rel="nofollow noreferrer">Kubernetes Tips - Part 1 blog post from Alen Komljen</a>.</p>
<p>Your use case is different. You want to get requests from outside the kubernetes cluster to exposed loadbalancer and then direct traffic from it to another service within the cluster. It's not possible by built-in kubernetes terms, because service can be either <code>LoadBalancer</code> or <code>ExternalName</code>. You can see in your last manifest there are <strong>two</strong> types which will not work at all. See <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">service types</a>.</p>
</li>
<li><p>Avoid unnecessary complexity. It will be hard to keep track of everything since there will be more and more services and other parts.</p>
</li>
<li><p>Based on documentation it's generally possible to have issues using <code>ExternalName</code> with some protocols:</p>
<blockquote>
<p>Warning: You may have trouble using ExternalName for some common
protocols, including HTTP and HTTPS. If you use ExternalName then the
hostname used by clients inside your cluster is different from the
name that the ExternalName references.</p>
<p>For protocols that use hostnames this difference may lead to errors or
unexpected responses. HTTP requests will have a Host: header that the
origin server does not recognize; TLS servers will not be able to
provide a certificate matching the hostname that the client connected to.</p>
</blockquote>
<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/#externalname" rel="nofollow noreferrer">Reference - Warning</a></p>
</li>
</ol>
