大佬教程收集整理的这篇文章主要介绍了NGINX 背后的 Kubectl 代理:升级响应无效,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试将本地 Kubernates 集群添加到我的 GitLab 组以进行 CI/CD 部署。我已经开始运行以下命令:
kubectl proxy --address 0.0.0.0 --accept-hosts '.*'
我已经测试了它在同一网络中的另一台机器上执行 curl http://localhost:8001/API
和运行 curl http://192.168.1.2:8001/API
。代理在我的本地网络中可用。
下一步是在 kubernates.example.com
后面的 Internet 上提供代理。为此,我将 Nginx 配置如下:
server {
server_name kubernates.example.com;
Listen 443 ssl;
Listen 80;
include ssl_standart_conf;
LOCATIOn / {
proxy_pass http://192.168.1.2:8001/;
proxy_set_header Host $host;
proxy_set_header X-ForWARDed-For $proxy_add_x_forWARDed_for;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
执行 curl https://kubernates.example.com/API
返回以下错误:
invalID upgrade response: status code 200
Kubernates 代理日志
E0225 22:33:50.944018 1642369 upgradeaware.go:312] Proxy upgrade error: invalID upgrade response: status code 200
E0225 22:33:50.944060 1642369 proxy_server.go:144] Error while proxying request: invalID upgrade response: status code 200
好的,我已经设法解决了这个问题。下面的nginx配置做了个技巧
server {
server_name kubernates.example.com;
listen 443 ssl;
listen 80;
include ssl_standart_conf;
LOCATIOn / {
proxy_pass http://192.168.1.2:8001/;
proxy_set_header Host $host;
}
}
以上是大佬教程为你收集整理的NGINX 背后的 Kubectl 代理:升级响应无效全部内容,希望文章能够帮你解决NGINX 背后的 Kubectl 代理:升级响应无效所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。