简体   繁体   English

从 Azure k8s 外部访问 web 应用程序

[英]Access a web app from outside an Azure k8s

what is the best way to access a web app running in aks container from outside the cluster with a name, which is already defined in Azure DNS zone?从集群外部访问在 aks 容器中运行的 web 应用程序的最佳方法是什么,该名称已在 Azure DNS 区域中定义? and an external DNS server can be helpful for this?和外部 DNS 服务器对此有帮助吗?

I would setup an ingress that would point to your service which exposes the web app.我将设置一个指向您的服务的入口,该服务公开 web 应用程序。

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: simple-fanout-example
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: your.web.app.address
    http:
      paths:
      - path: /
        backend:
          serviceName: service
          servicePort: 8080

Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Ingress将 HTTP 和 HTTPS 路由从集群外部公开到集群内的服务 Traffic routing is controlled by rules defined on the Ingress resource.流量路由由 Ingress 资源上定义的规则控制。

    internet
        |
   [ Ingress ]
   --|-----|--
   [ Services ]

An Ingress may be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL / TLS, and offer name based virtual hosting. Ingress 可以配置为提供服务外部可访问的 URL、负载平衡流量、终止 SSL / TLS,并提供基于名称的虚拟主机。 An Ingress controller is responsible for fulfilling the Ingress, usually with a load balancer, though it may also configure your edge router or additional frontends to help handle the traffic. Ingress controller负责实现 Ingress,通常使用负载均衡器,但它也可以配置边缘路由器或其他前端来帮助处理流量。

An Ingress does not expose arbitrary ports or protocols. Ingress 不会暴露任意端口或协议。 Exposing services other than HTTP and HTTPS to the internet typically uses a service of type Service.Type=NodePort or Service.Type=LoadBalancer .向 Internet 公开 HTTP 和 HTTPS 以外的服务通常使用类型为Service.Type=NodePortService.Type=LoadBalancer的服务。

I would recommend reading Create an ingress controller in Azure Kubernetes Service (AKS) , or use Azure Application Gateway as an ingress this is explainedhere and you can find tutorials onGitHub I would recommend reading Create an ingress controller in Azure Kubernetes Service (AKS) , or use Azure Application Gateway as an ingress this is explainedhere and you can find tutorials onGitHub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM