我有一个openshift集群,所有服务都部署到该集群。除我的前端服务(即nginx docker容器)外,无法在群集之外访问所有服务。 这个nginx docker容器将api请求重定向到集群中的其他服务。到目前为止,一切都按预期进行。
问题是,如果删除并重新部署了一项服务,nginx将无法再重定向到该服务,并返回499客户端关闭请求错误。
我认为原因是因为吊舱名称在重新部署后发生了更改,这就是为什么它找不到服务的原因,但是我不确定。如果我的假设是正确的,我该如何解决这个问题或将我的问题放在其他地方?
我的Nginx配置:
worker_processes 1;
pid /run/nginx.pid;
events {
worker_connections 3072;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# configure caching according to file-type
map $sent_http_content_type $expires {
default off;
text/html epoch; # means no cache, as it is not a static page
text/css 1d;
application/javascript 1d;
application/woff2 1d;
# cache images for a day
~image/ 1d;
}
server {
listen 8080;
expires $expires;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html =404;
}
location /api/ {
proxy_pass http://kerberos/;
}
}
}