Open todaygood opened 6 years ago
上面web访问失败的原因,是我的环境的问题, broswer所在的机器,所在的环境DNS无法解析ruby-ex-hello.apps.test.cloud.genomics.cn,即使解析到192.168.122.103 了, 网络也是无法访问 192.168.122.103 的, 所以我要搞一个新的windows客户端环境,解决DNS解析和网络互通这两个问题,客户端就可以使用openshift web console了。
文件1 /var/lib/haproxy/router/routes.json
"hello:ruby-ex": {
"Name": "ruby-ex",
"Namespace": "hello",
"Host": "ruby-ex-hello.apps.test.cloud.genomics.cn",
"Path": "",
"TLSTermination": "",
"Certificates": null,
"VerifyServiceHostname": false,
"Status": "saved",
"PreferPort": "8080-tcp",
"InsecureEdgeTerminationPolicy": "",
"RoutingKeyName": "98b003e2430c51b69f06876c15db0b99",
"IsWildcard": false,
"Annotations": {
"openshift.io/generated-by": "OpenShiftWebConsole",
"openshift.io/host.generated": "true"
},
"ServiceUnits": {
"hello/ruby-ex": 100
},
"ServiceUnitNames": {},
"ActiveServiceUnits": 1,
"ActiveEndpoints": 0
},
"default:docker-registry": {
"Name": "docker-registry",
"Namespace": "default",
"Host": "docker-registry-default.apps.test.cloud.genomics.cn",
"Path": "",
"TLSTermination": "passthrough",
"Certificates": null,
"VerifyServiceHostname": false,
"Status": "saved",
"PreferPort": "",
"InsecureEdgeTerminationPolicy": "",
"RoutingKeyName": "172555eec50a0d95563a405b15a8a45f",
"IsWildcard": false,
"Annotations": {
"openshift.io/host.generated": "true"
},
"ServiceUnits": {
"default/docker-registry": 100
},
"ServiceUnitNames": {
"default/docker-registry": 256
},
"ActiveServiceUnits": 1,
"ActiveEndpoints": 1
},
# Secure backend, pass through
backend be_tcp:default:docker-registry
balance source
hash-type consistent
timeout check 5000ms
server pod:docker-registry-2-5zpz2:docker-registry:10.130.2.21:5000 10.130.2.21:5000 weight 256
# Plain http backend
backend be_http:hello:ruby-ex
mode http
option redispatch
option forwardfor
balance leastconn
timeout check 5000ms
http-request set-header X-Forwarded-Host %[req.hdr(host)]
http-request set-header X-Forwarded-Port %[dst_port]
http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
http-request set-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header Forwarded for=%[src];host=%[req.hdr(host)];proto=%[req.hdr(X-Forwarded-Proto)]
cookie 98b003e2430c51b69f06876c15db0b99 insert indirect nocache httponly
server pod:ruby-ex-1-qzzcd:ruby-ex:10.131.0.7:8080 10.131.0.7:8080 cookie 8669b06544a01e34745146110cfa6133 weight 256
Issue
按照文档,部署了一个ruby-ex业务程序,发现
Investigation
在Fedora28这个oc客户端上测试,发现不行。
注意我访问的是8080端口,实际上是错误的,出现这个错误是因为没有理解route仅支持http, https协议这个知识点。
调试方法:
在普通用户margin下面
没有看到router pod , 需要在admin下面去看。
发现在ose7或者ose6上, 于是dig ruby-ex-hello.apps.test.cloud.genomics.cn 解析为192.168.122.103 就是正确的。
在ose7节点上面发现一切正常。
回到Fedora28上, curl http://ruby-ex-hello.apps.test.cloud.genomics.cn/ 也是成功的。
知识点
router 默认http,https使用的是80,443端口,端口对应http,https协议,这也是文档中强调route只适用于http,https这类协议。
这个是实现了 ruby-ex-hello.apps.test.cloud.genomics.cn:80或者443 <==> service ruby-ex
映射关系。
serivce的访问方式是: 172.30.150.29:8080
[root@ose0 ~]# oc get endpoints NAME ENDPOINTS AGE ruby-ex 10.131.0.7:8080 4h
ClusterIP ( 172.30.150.29:8080 ) | Endpoints ( 10.131.0.7:8080)
参考: https://docs.openshift.org/3.6/admin_guide/sdn_troubleshooting.html#debugging-the-router