任何人都可以帮助我了解是否有可能在k8的节点内部署一个空的Pod,以进行基本的网络调试。PS:部署此Pod后,我应该能够exec
。
答案 0 :(得分:1)
只需部署一个包含所需容器的Pod,并执行任何操作即可。
将该规范保存到Yaml文件中:
apiVersion: v1
kind: Pod
metadata:
name: empty
spec:
containers:
- name: empty
image: alpine
command: ["cat"]
然后通过kubectl apply -f $filename
答案 1 :(得分:0)
您可以将kubectl
与generator一起使用。
# Create an idle pod
$ kubectl run --generator=run-pod/v1 idle-pod -i --tty --image ubuntu -- bash
root@idle-pod:/# # Debug whatever you want inside the idle container
root@idle-pod:/# exit
$
# Exec into idle pod
$ kubectl exec -i --tty idle-pod bash
root@idle-pod:/# # Debug whatever you want inside the idle container
root@idle-pod:/# exit
$
# Delete the idle pod
$ kubectl delete pod idle-pod
pod "idle-pod" deleted
$