进入节点(临时)
进入节点(临时)
kubectl debug node/node1 -it --image=busybox:1.36
# 容器内:宿主根文件系统在 /host
chroot /host df -h
chroot /host crictl ps | head需要保留现场时的清单(谨慎使用)
需要保留现场时的清单(谨慎使用)
apiVersion: v1
kind: Pod
metadata:
name: node-debug
spec:
hostNetwork: true
hostPID: true
containers:
- name: shell
image: busybox:1.36
command: ["sleep", "infinity"]
securityContext:
privileged: true
volumeMounts:
- name: host-root
mountPath: /host
volumes:
- name: host-root
hostPath:
path: /挂载宿主根且开启特权相当于节点 root 权限:用完立即删除,生产集群建议用准入策略限制这类 Pod。