Last Updated: October 29, 2016
·
2.245K
· trinitronx

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:

OR: Set them manually when running kubectl:

kubectl exec -ti busybox-1208611305-a4b1a  -- env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM /bin/bash