我试图附加到Kubernetes中的正在运行的容器,但是我收到下面的错误消息.
>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.
如何在容器yaml中启用TTY?
解决方法
为了在连接时有适当的TTY和stdin:
kubectl attach -it POD -c CONTAINER
必须使用tty:true和stdin:true配置容器.
默认情况下,这两个值均为false:https://kubernetes.io/docs/api-reference/v1.5/#container-v1
示例Pod:
spec: containers: - name: web image: web:latest tty: true stdin: true