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 default namespace and I don't want to delete and recreate it a new one on the kube-system namespace so I want my Load balancer in the default namespace to have the ingress pods as endpoints:
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
Is that possible? Is there something I should add in the selector fields?
I tried creating a clusterIP service in the kube-system namespace that communicates with the ingress pods, it worked.
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
Then, I tried referencing that service to my loadbalancer in the default namespace like that:
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
But no result. The clusterIP points to the Ingress pods, but the load balancer remains without endpoints.