Kubernetes Service Object ExternalName pointing to Azure CDN

1/28/2021

My app is running on Windows Containers using AKS. Now we are trying to migrate our Static Assets to Azure Blob/Azure CDN and serve assets from there instead of our App. Following various articles, I setup the below way with no success.

apiVersion: v1
kind: Service
metadata:
  name: app-fe
  namespace: fe-ns
  labels:
    app.kubernetes.io/name:app-fe
    helm.sh/chart: os-20210118.1
    app.kubernetes.io/instance: prod
    app.kubernetes.io/managed-by: Helm
spec:
  type: ExternalName
  externalName: fe-assets.azureedge.net

Ingress file

annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
  rules:
    - host: "domain.com"
      http:
        paths:
          - path: /
            backend:
              serviceName: app-fe
              servicePort: 80/443 (tried with both)

Any leads on this is appreciated. Thanks

-- Reddipalle Nagarjun
containers
kubernetes
nginx

1 Answer

1/28/2021

Apparently this won't work because Kubernetes goes to CDN using IP address and not hostname. All CDNs will return you something like 503 in return because this is not how they're supposed to work.

-- Vasili Angapov
Source: StackOverflow