简体   繁体   English

离子 web 应用程序页面未通过 Ingress Controller 打开

[英]Ionic web app pages not opening with Ingress Controller

I have Ionic 5.0 Web App running on by Google K8s cluster.我有由 Google K8s 集群运行的 Ionic 5.0 Web 应用程序。 I am using Nginx Ingress Controller.我正在使用 Nginx 入口 Controller。 Following ingress resource is configured for it to make it accessible:为它配置了以下入口资源以使其可访问:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: gateway-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/use-regex: true
spec:
  rules:
    - http:
        paths:
          - path: /webapp/(/|$)(.*)
            backend:
              serviceName: webapp-frontend
              servicePort: 80

I am able to access the application using the following url:我可以使用以下 url 访问应用程序:

I am not getting what is wrong with the configuration here.我没有得到这里的配置有什么问题。 Please help.请帮忙。

####EDIT#### ####编辑####

My web application is deployed on pod and have following URL and this is exposed through service 'webapp-frontend':我的 web 应用程序部署在 pod 上并具有以下 URL 并且通过服务“webapp-frontend”公开:

What i want is when user hit the url on browser following should happen:我想要的是当用户在浏览器上点击 url 时应该发生以下情况:

There are some thing you should look at:有一些事情你应该看看:

  • NetworkPolicy in the extensions/v1beta1 API version is no longer served from Kubernetes version 1.16. extensions/v1beta1 API 版本中的 NetworkPolicy 不再从 Kubernetes 版本 1.16 提供。 You should use networking.k8s.io/v1beta1 instead.您应该改用networking.k8s.io/v1beta1

  • You are using the rewrite annotation and basing on your config it should:您正在使用rewrite 注释并根据您的配置它应该:

http://1.2.3.4/webapp rewrite to http://1.2.3.4/ http://1.2.3.4/webapp重写为http://1.2.3.4/

http://1.2.3.4/webapp/ rewrite to http://1.2.3.4/ http://1.2.3.4/webapp/改写为http://1.2.3.4/

http://1.2.3.4/webapp/login rewrite to http://1.2.3.4/login http://1.2.3.4/webapp/login重写为http://1.2.3.4/login

You need to make sure that your Ingress is hitting the right URL.您需要确保您的 Ingress 命中正确的 URL。 The config itself looks fine.配置本身看起来不错。 The error might be in the logic behind the rewrite that you would like to implement.错误可能在您想要实现的重写背后的逻辑中。 Refer to the linked documentation if needed.如果需要,请参阅链接的文档 If it is still not working as intended, than please edit your question and provide more details (what should be rewrited where, etc).如果它仍然没有按预期工作,请编辑您的问题并提供更多详细信息(应该在哪里重写等)。

This should address your issue from the Kuberentes side.这应该从 Kuberentes 方面解决您的问题。 Please let me know if that helped.请让我知道这是否有帮助。

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

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