gpt4 book ai didi

kubernetes - Istio Ingress 路由失败,对 Kubernetes 中的 Shiny 服务器发出 400 Bad request

转载 作者:行者123 更新时间:2023-12-02 12:10:56 29 4
gpt4 key购买 nike

我正在 Kubernetes 中部署一个 Shiny 的服务器,它有 istio 入口。
我们也安装了一个正常运行的入口网关。
但是当我尝试通过网关访问我 Shiny 的服务器时,它因 400 Bad Request 而失败。
网关已启用 https。
我尝试了对 Shiny-server.conf 文件和用于 Shiny 服务器的 virtualservice.yml 的多次修改,但没有成功。我什至不知道如何进行进一步的故障排除。
请帮忙。
用于 Shiny 服务器应用程序的 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 包。
添加此包后,它开始工作。
谢谢。

关于kubernetes - Istio Ingress 路由失败,对 Kubernetes 中的 Shiny 服务器发出 400 Bad request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63117317/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com