Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
540 views
in Technique[技术] by (71.8m points)

nginx - Kubernetes Service Object ExternalName pointing to Azure CDN

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

question from:https://stackoverflow.com/questions/65929725/kubernetes-service-object-externalname-pointing-to-azure-cdn

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...