9

I have an ExternalName service:

apiVersion: v1
kind: Service
metadata:
  name: external
  namespace: default
spec:
  externalName: my-site.com
  ports:
  - port: 443
    protocol: TCP
    targetPort: 443
  type: ExternalName

And an Ingress path:

spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: external
          servicePort: 443
        path: /*

But saving the ingress returns:

Error during sync: error while evaluating the ingress spec: service "default/external" is type "ExternalName", expected "NodePort" or "LoadBalancer"

GCE ingress should support ExternalName services (or at least there isn't easily findable documentation suggesting otherwise) and that error is hard to track down.

hyperbell
  • 107
  • 4

1 Answers1

6

GCE ingresses do not support type: ExternalName due to the fact that they use GCE LB as the providing infrastructure. the GCE LB can't use it as a backend.

I recommend posting this as a Feature Request on Google's Issue tracker

Patrick W
  • 4,603
  • 1
  • 12
  • 26
  • was an issue ever logged about this? – jpbochi Mar 11 '20 at 16:00
  • Now, this setup seems to be possible (no "ExternalName" error). However, I am facing a different issue - GKE Ingress uses healthchecks for backends which don't seem to work with ExternalName services, even though the service is configured properly and gives 200 code when testing manually. – Martin Grůber Jun 14 '21 at 17:55
  • tbh I'd have to look under the hood for that, my guess is that because the externalName is performing a redirect, the first response you get from the server is not 200 but something else. The end result is a 200. If you were to curl the same IP:port that the healthcheck is using, you likely don't get a 200 – Patrick W Jun 15 '21 at 18:39
  • ExternalName works for you? I'm having trouble getting it to work. If you wouldn't mind, could you take a look at my setup is here? Thank you. https://stackoverflow.com/questions/69945853/connecting-external-service-to-gcp-gke-kubernetes-cluster-with-googles-external . – wei Nov 30 '21 at 17:21