簡體   English   中英

Istio Ingress 路由失敗並出現 400 Bad request for Kubernetes 中的 shiny 服務器

[英]Istio Ingress routing fails with 400 Bad request for shiny server in Kubernetes

我正在 Kubernetes 中部署一個具有 istio 入口的 shiny 服務器。 我們也安裝了一個正常工作的入口網關。

但是當我嘗試通過網關訪問我的 shiny 服務器時,它會失敗並顯示 400 Bad Request。 網關啟用了 https。 我嘗試對 shiny 服務器的 shiny-server.conf 文件和 virtualservice.yml 進行多次修改,但沒有成功。 我什至不知道如何進行進一步的故障排除。

請幫忙。

閃亮服務器應用程序的 Dockerfile

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 文件:

# 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 部署:

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/

需要一些幫助來確定原因或我應該采取的方向。

謝謝並恭祝安康。

它現在似乎正在工作。 我忘了在我最新的 Dockerfile 中添加 httpuv package。 添加此 package 后,它開始工作。

謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM