Kubernetes Externalname working with https

7/30/2018

We are trying to create an ExternalName service for Kubernetes to hide URL linking to our Firebase:

kind: Service
apiVersion: v1
metadata:
  name: firebase
  namespace: devel
spec:
  type: ExternalName
  externalName: firebase-project-123456.firebaseio.com

The service is created correctly, and we can ping to http://firebase. However connecting to the firebase endpoint doesn't work:

curl -v http://firebase/activity.json
< HTTP/1.1 404 Not Found
< Content-Type: text/html; charset=UTF-8
< Referrer-Policy: no-referrer

One idea is that there is an issue with https (as the target service runs on https), however then we wouldn't probably get 404, but some other error. I have no idea what might be wrong on the way.

-- Vojtěch
kubernetes

1 Answer

7/30/2018

You might be running into a virtual host issue. firebase-project-123456.firebaseio.com is a virtual host name which is then used to route your request to the correct backend. A Kubernetes external service is essentially a DNS CNAME, which forces a second DNS lookup for the actual host name.

See if this works for you:

curl -v -H "Host: firebase-project-123456.firebaseio.com" http://firebase/activity.json

If it does, that's what you're running into. You might have to make a trivially simple service instead, which proxies your requests to the correct URL at firebase.

-- Marcin Romaszewicz
Source: StackOverflow