No alive nodes found in your cluster Istio: upstream connect error or disconnect/reset before header | 码农网

Istio: upstream connect error or disconnect/reset before header

栏目: IT技术 · 发布时间: 2天前

来源: 网络

按照官方文档跑 bookinfo 例子,访问 productpage 的时候提示: upstream connect error or disconnect/reset before header

通过命令查看 productpage 的 istio proxy 的日志,日志都是 info 级别,通过调整 level 可以查看到更多 Envoy 的详细日志,打开方式可以通过 port-forward 来访问:

kubectl port-forward productpage-v1-6c5578cc4-z8dgq 15000:15000

curl 命令强制开启 trace 日志:

curl -X POST 127.0.0.1:15000/logging?level=trace

在此访问 productpage 页面,并查看 istio proxy 的日志,可以发现如下错误:

[2018-10-07 15:00:51.379][29][debug][router] external/envoy/source/common/router/router.cc:252] [C0][S13874950066935357807] cluster 'outbound|9091||istio-telemetry.istio-system.svc.cluster.local' match for URL '/istio.mixer.v1.Mixer/Report'                                                                    
[2018-10-07 15:00:51.379][29][debug][router] external/envoy/source/common/router/router.cc:303] [C0][S13874950066935357807] router decoding headers:      
':method', 'POST'                                                                                                                                         
':path', '/istio.mixer.v1.Mixer/Report'                                                                                                                   
':authority', 'mixer'                                                                                                                                     
':scheme', 'http'                                                                                                                                         
'te', 'trailers'                                                                                                                                          
'grpc-timeout', '5000m'                                                                                                                                   
'content-type', 'application/grpc'                                                                                                                        
'x-istio-attributes', 'CkMKCnNvdXJjZS51aWQSNRIza3ViZXJuZXRlczovL3Byb2R1Y3RwYWdlLXYxLTZjNTU3OGNjNC16OGRncS5kZWZhdWx0'                                      
'x-envoy-internal', 'true'                                                                                                                                
'x-forwarded-for', '10.1.1.100'                                                                                                                           
'x-envoy-expected-rq-timeout-ms', '5000'                                                                                                                  
                                                                                                                                                          
[2018-10-07 15:00:51.379][29][debug][client] external/envoy/source/common/http/codec_client.cc:25] [C67] connecting                                       
[2018-10-07 15:00:51.379][29][debug][connection] external/envoy/source/common/network/connection_impl.cc:572] [C67] connecting to 10.1.1.59:9091  

并且提示 timeout:

[2018-10-07 15:00:52.382][29][debug][pool] external/envoy/source/common/http/http2/conn_pool.cc:174] [C67] connect timeout   

并且通过查看 Envoy 的配置(通过 curl 10.1.1.100:15000/config_dump 获取):

         "http_filters": [                                                                                                                              
            {                                                                                                                                             
             "name": "mixer",                                                                                                                             
             "config": {                                                                                                                                  
              "transport": {                                                                                                                              
               "check_cluster": "outbound|9091||istio-policy.istio-system.svc.cluster.local",                                                             
               "network_fail_policy": {                                                                                                                   
                "policy": "FAIL_CLOSE"                                                                                                                    
               },                                                                                                                                         
               "report_cluster": "outbound|9091||istio-telemetry.istio-system.svc.cluster.local",                                                         
               "attributes_for_mixer_proxy": {                                                                                                            
                "attributes": {                                                                                                                           
                 "source.uid": {                                                                                                                          
                  "string_value": "kubernetes://productpage-v1-6c5578cc4-z8dgq.default"                                                                   
                 }                                                                                                                                        
                }                                                                                                                                         
               }                                                                                                                                          
              },                                                                                                                                          
              "service_configs": {                                                                                                                        
               "default": {}                                                                                                                              
              },                                                                                                                                          
              "default_destination_service": "default",                                                                                                   
              "mixer_attributes": {                                                                                                                       
               "attributes": {                                                                                                                            
                "destination.port": {                                                                                                                     
                 "int64_value": "9080"                                                                                                                    
                },                                                                                                                                        
                "context.reporter.uid": {                                                                                                                 
                 "string_value": "kubernetes://productpage-v1-6c5578cc4-z8dgq.default"                                                                    
                },                                                                                                                                        
                "destination.namespace": {                                                                                                                
                 "string_value": "default"                                                                                                                
                },                                                                                                                                        
                "destination.ip": {                                                                                                                       
                 "bytes_value": "AAAAAAAAAAAAAP//CgEBZA=="                                                                                                
                },                                                                                                                                        
                "destination.uid": {                                                                                                                      
                 "string_value": "kubernetes://productpage-v1-6c5578cc4-z8dgq.default"        

根据 listener 的 filter 和日志可以判断出,Envoy 再访问 istio-policyistio-telemetry 的时候超时,通过 kubectl exec -it 登录到 istio-policyistio-telemetry 容器里面查看 ip ,也验证 10.1.1.59 是容器 ip,再 productpageistio-proxy 容器里无法访问到 istio-policy 的容器 ip,而直接 ping istio-policy.istio-system.svc.cluster.local 得到的 ip 却是 10.152.183.219 ,令人费解。

初步推断是 networking 出问题了。

可以查看 bridge

sudo brctl show

可以看到信息:

bridge name     bridge id               STP enabled     interfaces
cbr0            8000.c64875066a1c       no              veth019bd18c
                                                        veth1c0d2c9b
                                                        veth1c61c1f5
                                                        veth354f63c2
                                                        veth3dcf1b58
                                                        veth5e48d40c
                                                        veth5ecef8bd
                                                        veth64c402e3
                                                        veth6cdd40a2
                                                        veth734c71a0
                                                        veth83002aa8
                                                        veth84f9ea9e
                                                        veth89b6dca2
                                                        veth9a2e7811
                                                        vetha39fd5f9
                                                        vethaa60e8e9
                                                        vethb049a2ee
                                                        vethb1790152
                                                        vethbcfdb892
                                                        vethcb714c1d
                                                        vethce18a83b
                                                        vethcee858ed
                                                        vethd59ca64b
                                                        vethe7e21373
docker0         8000.02428d87c40c       no

cbr0 是存在的,基本说明是 bridge 出问题了,搜索 syslog

grep -i cni /var/log/syslog

可以看到错误信息:

Oct  9 07:36:27 pzhang microk8s.daemon-kubelet[27091]: W1009 07:36:27.967830   27091 cni.go:188] Unable to update cni config: No networks found in /etc/cni/net.d
Oct  9 07:36:33 pzhang microk8s.daemon-kubelet[27299]: W1009 07:36:33.291419   27299 cni.go:188] Unable to update cni config: No networks found in /etc/cni/net.d

所以需要解决为什么 microk8snetwork-plugin 出问题,需要继续 Google …

Google 到官方文档: https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/ kubenet 并不会创建 CNI ,所以上面的 warning 无关紧要。

通过 sudo nsenter -p -n ping 10.1.1.53 在一个 container 去 ping 另外一个 container 是不通的,通过 tcpdump 也只能看到信息: 1412 14:27:46.087292 10.1.1.50 10.1.1.53 ICMP 98 Echo (ping) request id=0x3ed4, seq=29/7424, ttl=64 (no response found!)

最后要给 microk8s 提交 issue 的时候,被告知要提交 microk8s.inspect 的结果,出现警告:

WARNING:  IPtables FORWARD policy is DROP. Consider enabling traffic forwarding with: sudo iptables -P FORWARD ACCEPT

执行 iptables -L

Chain FORWARD (policy DROP)                                                                                                                               
target     prot opt source               destination                                                                                                      
DOCKER-ISOLATION  all  --  anywhere             anywhere                                                                                                  
DOCKER     all  --  anywhere             anywhere                                                                                                         
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED                                                                 
ACCEPT     all  --  anywhere             anywhere                                                                                                         
ACCEPT     all  --  anywhere             anywhere                                                                                                         
DOCKER-USER  all  --  anywhere             anywher

执行 sudo iptables -P FORWARD ACCEPT 打开 FORWARD 后,网络就一切 OK 了。

估计因为安装的是 ubuntu-server 版本,默认 iptables 开启了防火墙规则,以后碰到网路问题多注意 iptables


以上所述就是小编给大家介绍的《Istio: upstream connect error or disconnect/reset before header》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

标签: istio: upstream connect error or disconnect/reset before header

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Computational Geometry

Computational Geometry

Mark de Berg、Otfried Cheong、Marc van Kreveld、Mark Overmars / Springer / 2008-4-16 / USD 49.95

This well-accepted introduction to computational geometry is a textbook for high-level undergraduate and low-level graduate courses. The focus is on algorithms and hence the book is well suited for st......一起来看看 《Computational Geometry》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具