k8s kubeadm方式开启debug模式
k8s kubeadm 使用debug模式进行配置
·
进入到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 -
更多推荐
已为社区贡献11条内容
所有评论(0)