问题描述
我通过kubeadm安装kubernetes,然后关闭并重新启动。
然后只有kubectl port-forward
不起作用。
以下命令有效。
kubectl top nodes
但是kubectl端口转发失败。有什么建议吗? 似乎只有端口转发转到localhost:8080。 不起作用
sudo kubectl port-forward -n istio-system svc/istio-ingressgateway 80:80 --address 0.0.0.0
以下是正常模式下的日志。
The connection to the server localhost:8080 was refused - did you specify the right host or port?
有关调试模式日志
I0930 01:44:46.904299 47718 round_trippers.go:423] curl -k -v -XGET -H "Accept: application/json,*/*" -H "User-Agent: kubectl/v1.17.12 (linux/amd64) kubernetes/5ec4722" 'http://localhost:8080/api?timeout=32s'
I0930 01:44:46.904927 47718 round_trippers.go:443] GET http://localhost:8080/api?timeout=32s in 0 milliseconds
I0930 01:44:46.904948 47718 round_trippers.go:449] Response Headers:
I0930 01:44:46.904987 47718 cached_discovery.go:121] skipped caching discovery info due to Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
I0930 01:44:46.905009 47718 shortcut.go:89] Error loading discovery information: Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
I0930 01:44:46.905067 47718 round_trippers.go:423] curl -k -v -XGET -H "Accept: application/json,*/*" -H "User-Agent: kubectl/v1.17.12 (linux/amd64) kubernetes/5ec4722" 'http://localhost:8080/api?timeout=32s'
I0930 01:44:46.905222 47718 round_trippers.go:443] GET http://localhost:8080/api?timeout=32s in 0 milliseconds
I0930 01:44:46.905240 47718 round_trippers.go:449] Response Headers:
I0930 01:44:46.905263 47718 cached_discovery.go:121] skipped caching discovery info due to Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
I0930 01:44:46.905325 47718 round_trippers.go:423] curl -k -v -XGET -H "Accept: application/json,*/*" -H "User-Agent: kubectl/v1.17.12 (linux/amd64) kubernetes/5ec4722" 'http://localhost:8080/api?timeout=32s'
I0930 01:44:46.905465 47718 round_trippers.go:443] GET http://localhost:8080/api?timeout=32s in 0 milliseconds
I0930 01:44:46.905482 47718 round_trippers.go:449] Response Headers:
I0930 01:44:46.905504 47718 cached_discovery.go:121] skipped caching discovery info due to Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
I0930 01:44:46.905556 47718 round_trippers.go:423] curl -k -v -XGET -H "Accept: application/json,*/*" -H "User-Agent: kubectl/v1.17.12 (linux/amd64) kubernetes/5ec4722" 'http://localhost:8080/api?timeout=32s'
I0930 01:44:46.905695 47718 round_trippers.go:443] GET http://localhost:8080/api?timeout=32s in 0 milliseconds
I0930 01:44:46.905712 47718 round_trippers.go:449] Response Headers:
I0930 01:44:46.905734 47718 cached_discovery.go:121] skipped caching discovery info due to Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
I0930 01:44:46.905759 47718 helpers.go:221] Connection error: Get http://localhost:8080/api?timeout=32s: dial tcp 127.0.0.1:8080: connect: connection refused
F0930 01:44:46.905785 47718 helpers.go:114] The connection to the server localhost:8080 was refused - did you specify the right host or port?
kubectl config view
是
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://172.31.3.157:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
作为参考,下面是工作的kubectl top nodes
调试模式,
(日志太长,我只附加了标题)
I0930 01:46:47.625764 49195 loader.go:375] Config loaded from file: /home/ubuntu/.kube/config
I0930 01:46:47.641064 49195 round_trippers.go:423] curl -k -v -XGET -H "User-Agent: kubectl/v1.17.12 (linux/amd64) kubernetes/5ec4722" -H "Accept: application/json,*/*" 'https://172.31.3.157:6443/api?timeout=32s'
I0930 01:46:47.680091 49195 round_trippers.go:443] GET https://172.31.3.157:6443/api?timeout=32s 200 OK in 39 milliseconds
I0930 01:46:47.680116 49195 round_trippers.go:449] Response Headers:
I0930 01:46:47.680123 49195 round_trippers.go:452] Cache-Control: no-cache,private
I0930 01:46:47.680128 49195 round_trippers.go:452] Content-Type: application/json
I0930 01:46:47.680134 49195 round_trippers.go:452] Content-Length: 135
I0930 01:46:47.680139 49195 round_trippers.go:452] Date: Wed,30 Sep 2020 01:46:47 GMT
I0930 01:46:47.680340 49195 request.go:1017] Response Body: {"kind":"APIVersions","versions":["v1"],"serverAddressByClientCIDRs":[{"clientCIDR":"0.0.0.0/0","serverAddress":"172.31.3.157:6443"}]}
I0930 01:46:47.680594 49195 round_trippers.go:423] curl -k -v -XGET -H "Accept: application/json,*/*" -H "User-Agent: kubectl/v1.17.12 (linux/amd64) kubernetes/5ec4722" 'https://172.31.3.157:6443/apis?timeout=32s'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)