Skip to content

Instantly share code, notes, and snippets.

@empeje
Created October 26, 2019 21:56
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 empeje/d0534317c04e720b530c674cde90bacc to your computer and use it in GitHub Desktop.
Save empeje/d0534317c04e720b530c674cde90bacc to your computer and use it in GitHub Desktop.
ops.sh

opssh

Collection of scripts, opssh is a collection of commands (mostly Linux) for doing ops stuffs

Networking

List of listened ports

# Long output
netstat -ap tcp | grep -i "listen"
# Short output
lsof -PiTCP -sTCP:LISTEN

SSH Tunneling

ssh -nNT -L $LOCAL_PORT:$LOCATION_REACHED_FROM_REMOTE:$REMOTE_PORT $USER@$HOST -p $PORT

Container

List of all docker service

docker service ls

Get all environment variable form Docker container

docker exec -it $CONTAINER_ID env

Get Host IP Address from inside Docker container

/sbin/ip route|awk '/default/ { print $3 }'

Kubernetes

Force delete helm chart

helm delete $chart-name --purge

Delete all helm chart

helm delete $(helm ls --all | grep -v 'NAME' | awk '{print $1}') --purge

Get ClusterIP of a ClusterIP register helm chart

kubectl get services $helm_chart_name-$helm_service_name | grep ClusterIP | awk '{print $3}'

Debug Helm output

helm install --dry-run --debug $chart_dir --set $a_value_to_override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment