我正在Kubernetes中部署一个有istio-ingress的闪亮服务器。我们也安装了一个正常工作的ingressgateway。
但当我试图通过网关访问我闪亮的服务器时,它以400坏请求失败。网关已使用https启用。我尝试了多次修改shiny-server.conf文件和shiny-server的virtualservice.yml,但没有成功。我甚至不知道如何进行进一步的故障排除。
请帮忙。
shinyserver应用的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个坏请求。https://10.20.33.134:32000/executive/
需要一些帮助来确定原因或我应该采取的方向。
谢谢和问候。
它现在似乎正在工作。我忘了在我最新的Dockerfile中添加httpuv包。添加此包后,它开始工作。
谢谢。