Many a time we run containers in kubernetes in controlled environment and many IP's are restricted and internet is not allowed specially in private environment case. And we do not have enough utilities within that environmet to download any package for troubleshooting purpose.
Work Around
Use the following git repo that is having a special container packaged with below enlisted tool for troubleshooting purpose within kubernetes environment.
Git Repo :https://github.com/ibraraziz/netshoot
Tools included within container:
apache2-utils
bash
bind-tools
bird
bridge-utils
busybox-extras
calicoctl
conntrack-tools
ctop
curl
dhcping
drill
ethtool
file
fping
httpie
iftop
iperf
iproute2
ipset
iptables
iptraf-ng
iputils
ipvsadm
jq
libc6-compat
liboping
mtr
net-snmp-tools
netcat-openbsd
netgen
nftables
ngrep
nmap
nmap-nping
openssl
py-crypto
py2-virtualenv
python2
scapy
socat
strace
swaks
tcpdump
tcptraceroute
termshark
tshark
util-linux
vim
websocat
How to use:
1. Create the pod by:
kubectl apply -f <repo name-share with you>
Command Below
Kubectl apply -f https://github.com/ibraraziz/netshoot/blob/master/configs/netshoot-sidecar.yaml
For Reference:
YAML Changes with respect to my environment as I have that yaml into my local system
kind: Deployment
metadata:
name: netshoot
labels:
app: netshoot
spec:
replicas: 1
selector:
matchLabels:
app: netshoot
template:
metadata:
labels:
app: netshoot
spec:
containers:
- name: netshoot
image: docker.io/nicolaka/netshoot
command: ["/bin/bash"]
args: ["-c", "while true; do ping localhost; sleep 60;done"]
2. Once created go and enlist the pod as below
3. Enter into the pod and start consuming the networking utilities.
Now you have entered into netshoot pod and now you can start using all the above tools packaged into it.
Sharing Sample Results:
So all tools are working which is packaged with this single container. We can take benefit in terms of network troubleshooting.
Perfect
ReplyDelete