Setting up a Kuberentes cluster with HTTP Load balancing ingress for RStudio and Shiny results in error pages

喜你入骨 提交于 2019-12-03 16:14:17

As Radek suggested, ingress.kubernetes.io/rewrite-target: / is required to re-write your requests. However, this is not currently supported by the GKE ingress controller and is the reason that you're receiving 404 responses.

Instead, on GKE, you must use an nginx ingress controller.

You will then be able to configure ingress for your rstudio and shiny images that obeys the rewrite rule:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: r-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - backend:
          serviceName: rstudio
          servicePort: 8787
        path: /rstudio/*
      - backend:
          serviceName: shiny1
          servicePort: 3838
        path: /shiny1/*
      - backend:
          serviceName: shiny5
          servicePort: 80
        path: /shiny5/*

the most likely problem you have is that when you go with this ingress you attached your URI is different then with direct accesc ( /shiny1/ vs / ) so your app is lost and has no content for that uri.

With Nginx Ingress Controller you can use ingress.kubernetes.io/rewrite-target: / annotation to mitigate this and make sure that / is accessed even when there is a subfolder in the ingress path.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!