openyurt: [BUG] kubectl exec failed with unable to upgrade connection after OpenYurt install
What happened:
kubectl exec (or kubectl port-forward / istionctl ps) fails with the following error.
Only master control-plane node can reproduce this issue.
root@control-plane:~# kubectl exec --stdin --tty ubuntu22-deamonset-5q6rg -- date
error: unable to upgrade connection: fail to setup the tunnel: fail to setup TLS handshake through the Tunnel: write unix @->/tmp/interceptor-proxier.sock: write: broken pipe
What you expected to happen:
kubectl exec (or kubectl port-forward / istionctl ps) succeeds w/o any error.
How to reproduce it (as minimally and precisely as possible):
- Setup Kubernetes Cluster with flannel, only control-plane is necesvirtualizedsary.
- OpenYurt v1.0 manual setting
- execute
kubectl execfor any container running on control-plane.
Anything else we need to know?:
Environment:
-
OpenYurt version: v1.0.0 (git clone with this tag
v1.0.0) -
Kubernetes version (use
kubectl version): v1.22.13 -
OS (e.g:
cat /etc/os-release):
root@ceci-control-plane:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
- Kernel (e.g.
uname -a):
root@ceci-control-plane:~# uname -a
Linux ceci-control-plane 5.4.0-126-generic #142-Ubuntu SMP Fri Aug 26 12:12:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
- Install tools: N.A
others
- This is 100% reproducible with vagrant virtualbox virtualized instance.
- Using physical machine, we are unable to reproduce this issue.
- Could be anything related underlying network interfaces? or options for
kubeadmorkubelet?
/kind bug
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 38 (30 by maintainers)
Commits related to this issue
- add FAQ about `write: broken pipe` via tunneling. https://github.com/openyurtio/openyurt/issues/1024 Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com> — committed to fujitatomoya/openyurt.io by fujitatomoya 2 years ago
- add FAQ about `write: broken pipe` via tunneling. (#238) https://github.com/openyurtio/openyurt/issues/1024 Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com> — committed to openyurtio/openyurt.io by fujitatomoya 2 years ago
@rambohe-ch i will close this one in favor of https://github.com/openyurtio/openyurt.io/pull/238
@fujitatomoya Thank you for updating faq tutorial, and i have merged this pull request. by the way, i will update the chinese faq tutorial soon.
@fujitatomoya Thanks for your feedback. I am glad that you have solved the problem of dns, and yurt-tunnel worked now.
btw: it looks like there are some unexpected configurations in kube-apiserver.yaml that lead to
127.0.0.1 ceci-control-plane ceci-control-planesetting in/etc/hostsfile.you can dive into the code for creating /etc/hosts file in here: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L330-L348 and find the root reason.
@rambohe-ch
i found that there is configuration in
/etc/hostson cloud master nodeInternalIPis192.168.56.20.with above configuration, openyurt sees that hostname
ceci-control-planeis127.0.1.1, and there is no such IP information in the cluster system. So it expects that is edge node via open-yurt-tunneling, and there will be no response since there is no openyurt-tunnel-agent on this cloud master. eventually pipeline cannot work.if we comment out
127.0.1.1 ceci-control-plane ceci-control-planeit works.@fujitatomoya ok, i can give some hints how to debug why traffic does not go through cloud node directly from kube-apiserver.
@rambohe-ch
and another question, I check the log of yurt-tunel-server according the FAQ of https://openyurt.io/docs/faq#yurt-tunnel.
We can see that pod
ubuntu22-deamonset-vkksron the cloud side, but exec command forward toyurt-tunnel-serverwith 127.0.0.1:46062 to 192.168.56.20:10250 (API server), according FAQ of https://openyurt.io/docs/faq#yurt-tunnel, it was not correct , is it?@fujitatomoya Thanks for your reply. i can give some short descriptions about
kubectl exectroubleshooting.kubectl execcommand don’t need to go through yurt-tunnel. only pods on edge nodes, yurt-tunnel will be involved.yurt-tunnel-dnspod that dns records come fromkube-system/yurt-tunnel-nodesconfigmap which managed byyurt-tunnel-server. if hostname resolution failed(for example: hostname for cloud nodes are resolved to ClusterIP of yurt-tunnel service), the reason maybe as following:yurt-tunnel-dnspod or notkube-system/yurt-tunnel-nodesconfigmap is correct or notkubectl execfor edge nodes failed to go through yurt-tunnel, you can check the following items:kubectl execrequest or not