Kubectl attach: Unable to use TTY container es- node does not select one

I am trying to connect to a running container in Kubernetes, however I am getting the error message below.

>kubectl attach -it es-client-2756725635-4rk43 -c es-node Unable to use a TTY - container es-node did not allocate one If you don't see a command prompt, try pressing enter. 

How to enable TTY in yaml container?

+5
source share
2 answers

To have the correct TTY and stdin when attaching:

 kubectl attach -it POD -c CONTAINER 

The container must be configured with tty: true and stdin: true . By default, both of these values ​​are: false : https://kubernetes.io/docs/api-reference/v1.5/#container-v1

Pod example:

 spec: containers: - name: web image: web:latest tty: true stdin: true 
+6
source

The reason this happens is because you are not passing a bash argument. This crashes when trying to create a tty connection.

Try:

 kubectl exec -it [POD-NAME] -c [CONTAINER-NAME] bash 
+3
source

Source: https://habr.com/ru/post/1257756/


All Articles