Skip to content

Instantly share code, notes, and snippets.

@lentzi90
Last active May 10, 2022 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lentzi90/965899addb3bf64cadd27a663b55b1ca to your computer and use it in GitHub Desktop.
Save lentzi90/965899addb3bf64cadd27a663b55b1ca to your computer and use it in GitHub Desktop.
Debugging
kubectl -n test run test --image ubuntu -it --rm
# Inside pod
apt update
apt install -y curl iputils-ping dnsutils netcat-openbsd redis-tools
kubectl -n test create svc clusterip test --tcp=8888:8888
kubectl -n test run test1 --image ubuntu -it --rm --port 8888 --labels="app=test" \
--overrides='{"spec": {"nodeName": "name-of-node"}}'
# Inside pod
apt update
apt install -y curl dnsutils netcat-openbsd
# Listen for incoming connections using netcat
netcat -l 8888
# Create another pod and connect to the first through the service
kubectl -n test run test2 --image ubuntu -it --rm --overrides='{"spec": {"nodeName": "name-of-node"}}'
# Inside pod
apt update
apt install -y curl dnsutils netcat-openbsd
# Curl the other pod through the service
curl test:8888
# Or connect with netcat
netcat test.test.svc.cluster.local 8888
# No host key checking, no know_hosts file
ssh -o ConnectTimeout=2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@a.b.c.d
# Additionally, use only the specified secret key
ssh -o ConnectTimeout=2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -F /dev/null -i ~/.ssh/id_rsa user@a.b.c.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment