kubectl attach:无法使用 TTY - 容器 es-node 没有分配一个 [英] kubectl attach: Unable to use a TTY - container es-node did not allocate one

查看:48
本文介绍了kubectl attach:无法使用 TTY - 容器 es-node 没有分配一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试附加到 Kubernetes 中正在运行的容器,但是我收到以下错误消息.

I am trying to attach to a running container in Kubernetes, however I get 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.

如何在我的容器 yaml 中启用 TTY?

How do I enable a TTY in my container yaml?

推荐答案

为了在attach时有正确的TTY和stdin:

In order to have proper TTY and stdin when doing attach:

kubectl attach -it POD -c CONTAINER

容器必须配置tty: truestdin: true.默认情况下,这两个值都是 false:https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#debugging

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

示例 Pod:

spec:
      containers:
      - name: web
        image: web:latest
        tty: true
        stdin: true

这篇关于kubectl attach:无法使用 TTY - 容器 es-node 没有分配一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆