Fix terminal rows, columns, and type when using old versions of kubectl exec
Problem
When using older versions of kubectl
(< 1.4
), the default terminal (TERM
variable) is set to dumb
, and the default row & column wrapping is set to very low values (LINES=24
, COLUMNS=80
).
This makes using some interactive readline programs such as vim
, less
, bash
difficult, kludgy, and inconvenient. This is especially annoying in bash
where long commands wrap badly & overwrite the same line making editing long commands difficult or impossible.
Solution
Either upgrade to kubectl
>= 1.4
at least after the following issues were fixed:
-
issue 9299 (commit
5a6ad93
) - FixedTERM=xterm
setting - issue 25273 - Fixed tty rows / columns setting
OR: Set them manually when running kubectl
:
kubectl exec -ti busybox-1208611305-a4b1a -- env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM /bin/bash
Written by James Cuzella
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Kubernetes
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#