Can anyone help in making me understand if it's possible to deploy an empty pod inside a node in k8's for basic network debugging.PS : I should be able to exec
this pod after its deployed.
You can just use kubectl
with 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
$
Just deploy a pod with a container you need and command which do nothing.
Save that spec to a yaml file:
apiVersion: v1
kind: Pod
metadata:
name: empty
spec:
containers:
- name: empty
image: alpine
command: ["cat"]
And then apply that yaml by kubectl apply -f $filename