Is there a way to serve external URLs from nginx-kubernetes ingress?

7/20/2018

Setup: Kubernetes cluster on AKS with nginx-kubernetes ingress. Azure Application Gateway routing domain with SSL certificate to nginx-kubernetes.

No problems serving everything in Kubernetes.

Now I moved static content to Azure Blob Storage. There's an option to use a custom domain, which works fine, but does not allow to use a custom SSL certificate. The only possible way is to set up a CDN and use the Verizon plan to use custom SSL certificates.

I'd prefer to keep all the routing in the ingress configuration, since some subroutes are directed to different Kubernetes services. Is there a way to mask and rewrite a path to the external blob storage url in nginx-kubernetes? Or is there any other available option that proxies an external url through ingress?

I don't mind having direct blob storage URLs for resources, but the main entry point should use the custom domain.

-- Markus Dresch
azure
kubernetes
nginx

1 Answer

7/20/2018

Not exactly the answer to the question, but the answer to the problem. Unfortunately this isn't documented very well. The solution is to create a service with a type of "ExternalName". According to https://akomljen.com/kubernetes-tips-part-1/ the service should look like this:

kind: Service
apiVersion: v1
metadata:
  name: external-service
  namespace: default
spec:
  type: ExternalName
  externalName: full.qualified.domain.name

I just tried it and it works like a charm.

-- Markus Dresch
Source: StackOverflow