Kubernetes - kubectl exec bash - session drop and line width

6.8k views Asked by At

I'm having k8s cluster with 3 minions, master and haproxy in front. When I use

kubectl exec -p $POD -i -t -- bash -il

for accessing bash in the pod (it is a single container in this case) I get in and after something like 5 mins I get dropped out of the terminal. If I reenter the container I can see my old bash process running, with a new started for my new connection. Is there a way to prevent this from happening? When I'm using docker exec it works fine and doesn't drop me so I guess it is from kubernetes.

As a bonus question - is there a way to increase the characters per line when using kubectl exec? I get truncated output that is different from docker exec.

Thanks in advance!

2

There are 2 answers

0
plamer On BEST ANSWER

It is a known issue - https://github.com/kubernetes/kubernetes/issues/9180

The kubelet webserver times out.

0
lufeng On

i have resolve by add env COLUMNS=$COLUMNS LINES=$LINES before bash kubectl exec -ti busybox env COLUMNS=$COLUMNS LINES=$LINES bash