kubernetes - Istio Ingress 路由失败,400 Bad request for shiny server in Kubernetes
问题描述
我正在 Kubernetes 中部署一个具有 istio 入口的闪亮服务器。我们也安装了一个正常工作的入口网关。
但是当我尝试通过网关访问我闪亮的服务器时,它会失败并显示 400 Bad Request。网关使用 https 启用。我尝试对闪亮服务器的 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 包。添加此软件包后,它开始工作。
谢谢。
推荐阅读
- xcode - 如何在命令行 xcode 构建中排除特定架构
- flexbox - Quasar Grid 左对齐最后一行的项目
- amazon-web-services - 从 AWS RDS 实例访问从 AWS RDS 快照导出到 S3 的数据库数据
- google-analytics - 为什么带有包含“gclid”的查询字符串的传入服务器请求格式错误?
- vue.js - Vuetify - 使用 URL 参数同步分页
- java - Kafka No Acknowledgement 可用作参数
- python - PyDrake:从机器人中提取 AutoDiff 梯度(通过微分逆运动学控制)
- php - Laravel PHP以特定方式返回数组
- c# - MVC SPA 应用程序
- .net - 在 Azure 中发布:不匹配依赖项错误。是什么导致它以及在通过管道使用发布时如何解决它?