首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Istio Ingress路由失败,Kubernetes中shiny服务器的400 Bad request

Istio Ingress路由失败,Kubernetes中shiny服务器的400 Bad request
EN

Stack Overflow用户
提问于 2020-07-27 22:19:24
回答 1查看 619关注 0票数 2

我正在Kubernetes中部署一个闪亮的服务器,它有istio入口。我们也安装了一个正常工作的入口网关。

但是,当我尝试通过网关访问我的闪亮服务器时,它失败了,出现了400 Bad Request。网关已启用https。我尝试了多次修改shiny-server.conf文件和shiny服务器的virtualservice.yml,但没有成功。我甚至不知道如何进行进一步的故障排除。

请帮帮忙。

shinyserver应用程序的Dockerfile

代码语言:javascript
复制
FROM rocker/shiny:3.6.3

# Install Ubuntu packages
RUN apt-get update && apt-get install sudo gdebi-core pandoc pandoc-citeproc libcurl4-gnutls-dev libxt-dev libssl-dev libxml2-dev libjpeg-dev -y


# Install R packages that are required

RUN R -e "install.packages(c('shiny', 'shinydashboardPlus', 'shinydashboard', 'jsonlite', 'dplyr', 'DT', 'config', 'shinyalert', 'curl', 'scales', 'plotly', 'shinyjs', 'data.table', 'shinythemes', 'gridExtra', 'ggplot2', 'httr', 'bsplus', 'shinyWidgets', 'ggiraph', 'ggiraphExtra', 'xml2', 'ggmap', 'leaflet', 'maps', 'viridis', 'htmlwidgets', 'zoo', 'reshape2', 'httpuv'), repos='http://cran.rstudio.com/')"

COPY /app /srv/shiny-server/executive/

EXPOSE 80

COPY shiny-server.conf  /etc/shiny-server/shiny-server.conf

CMD ["/usr/bin/shiny-server.sh"]

Shiny-server.conf文件:

代码语言:javascript
复制
# Define the user we should use when spawning R Shiny processes
run_as shiny;

# Define a top-level server which will listen on a port
server {
  # Instruct this server to listen on port 80. The app at dokku-alt need expose PORT 80, or 500 e etc. See the docs
  listen 80;

  # Define the location available at the base URL
  location / {

    # Run this location in 'site_dir' mode, which hosts the entire directory
    # tree at '/srv/shiny-server'
    app_dir /srv/shiny-server/executive;

    # Define where we should put the log files for this location
    log_dir /var/log/shiny-server;

    # Should we list the contents of a (non-Shiny-App) directory when the user
    # visits the corresponding URL?
    directory_index off;
  }
}

K8s部署:

代码语言:javascript
复制
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "executive"
  namespace: default
  labels:
    app: "executive"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: "executive"
  template:
    metadata:
      labels:
        app: "executive"
    spec:
      containers:
        - name: "executive"
          image: appexecutive1
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: "executive"
  namespace: default
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  type: ClusterIP
  selector:
    app: "executive"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: executive-ingress
  namespace: ingress-system
spec:
  hosts:
  - "*"
  gateways:
  - apollox-istio-gateway
  http:
  - match:
    - uri:
        prefix: /executive/
    rewrite:
        uri: /
    route:
    - destination:
        host: executive.default.svc.cluster.local
        port:
          number: 80

现在,当我尝试从我们系统中以下URL的网关访问它时,它以400 Bad Request失败。https://10.20.33.134:32000/executive/

我需要一些帮助来确定原因或我应该采取的方向。

谢谢并致以问候。

EN

回答 1

Stack Overflow用户

发布于 2020-07-28 15:59:25

它现在似乎起作用了。我忘了在最新的Dockerfile中添加httpuv包。添加此包后,它开始工作。

谢谢。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63117317

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档