kubectl attach: Unable to use a TTY - container es-node did not allocate one
In order to have proper TTY and stdin when doing attach:
kubectl attach -it POD -c CONTAINER
The container must be configured with tty: true
and stdin: true
.By default both of those values are false
: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#debugging
Example Pod:
spec: containers: - name: web image: web:latest tty: true stdin: true
The reason why it's failiing is because you're not passing the bash argument. This causes a failure when trying to create a tty connection.
Please try:
kubectl exec -it [POD-NAME] -c [CONTAINER-NAME] bash
For Windows, MINGW64 (git bash) does not seem to work, but PowerShell does!
kubectl exec -it abc-deployment-5d64659ff8-8tnnb -- /bin/bashroot@abc-deployment-5d64659ff8-8tnnb:/#