概述
在上一篇部署openshift origin的过程中相信你碰到了很多问题,本文就可能会碰到的问题做一汇总,希望能帮助你。
问题描述:
在openshift节点上安装ceph-common包时,可能会出现依赖包错误无法安装的情况
解决办法:
确认节点上有/etc/repos.d/epel.repo,并且文件里面不是enable=0
问题描述:
打开registry-console(镜像库)的界面时,在跳转时出现以下错误:
{"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
解决办法:
访问容器集群内部系统比如镜像库是通过跳转到openshift-web-console,验证通过后再跳转回来的,其原理是一个SSO系统,所以解决以上问题需要在openshift-web-console的oauthclient中增加跳转信任。
查看oauthclient:
oc get oauthclient
编辑oauthclient , openshift-web-console
oc edit oauthclient openshift-web-console
在最下面增加下面两行:
redirectURIs:
- https://openshift.test.com:8443/console/
问题描述:
你可能在测试环境或者生产环境部署的容器集群,然后在办公网访问集群,所以很有可能办公网到测试/生产环境的网络是不通的,只能通过堡垒机来访问。假设你是通过堡垒机上的nginx来做数据包转发,那么你会在nginx做相应的配置,如果你做的是4层转发,那么访问是没有问题的,但是如果你做的是7层转发,那么你会发现pod的logs和terminal不能正常显示。
解决办法:
出现以上问题是因为logs和terminal是用websocket协议做的,而nginx要支持websocket的话需要做额外的配置。
通过打开浏览器的developer tools,发现有很多websockets connection failed 403 错误, 如下:
WebSocket connection to 'wss://openshift.test.com:8443/apis/build.openshift.io/v1/namespaces/devops-team/buildconfigs?watch=true&resourceVersion=5717672' failed: Error during WebSocket handshake: Unexpected response code: 403
这说明logs 和terminal是用了websockets协议,我们需要在nginx配置中增加websockets支持,nginx配置如下:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8443 ssl http2;
server_name openshift.test.com;
ssl on;
add_header Access-Control-Allow-Origin *;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_intercept_errors on;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 86400;
proxy_set_header Origin '';
proxy_pass https://10.10.10.10:8443;
}
}
注释:
IP10.10.10.10是lb的IP地址
重启nginx再访问就好了。
更多容器技术请关注公众号: