进入到api-service中

vim /etc/kubernetes/manifests/kube-apiserver.yaml # 如下图所示:
- --feature-gates=EphemeralContainers=true

在这里插入图片描述

kube-scheduler.yaml

vim /etc/kubernetes/manifests/kube-scheduler.yaml
- --feature-gates=EphemeralContainers=true

在这里插入图片描述

/etc/sysconfig/kubelet

[root@hadoop002 manifests]# cat /etc/sysconfig/kubelet 
KUBELET_EXTRA_ARGS="--feature-gates=EphemeralContainers=true"

修改之后重启k8s控制节点和工作节点的kubelet

systemctl restart kubelet

使用debug

[root@hadoop002 k8s]# kubectl get po # 查看pod名称
NAME    READY   STATUS    RESTARTS   AGE
nginx   1/1     Running   0          116s
[root@hadoop002 k8s]# kubectl debug -it nginx --image=busybox:1.28  # 使用容器busybox来进入nginx中进行调试,如果有命名空间显示可以进项添加--target如:kubectl debug -it nginx --image=busybox:1.28 --target=nginx
Defaulting debug container name to debugger-z6mv2.
If you don't see a command prompt, try pressing enter.
/ # netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp        0      0 :::80                   :::*                    LISTEN      -

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐