Last active
October 10, 2018 07:14
-
-
Save jay-johnson/7cdf932e7595a6107175ad7cb5ce58e5 to your computer and use it in GitHub Desktop.
Bash function for logging into a Kubernetes container and running a command with support for N-args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sl() { | |
use_namespace="default" | |
pod_name=$(kubectl get pods -n ${use_namespace} | awk '{print $1}' | grep api | head -1) | |
kubectl exec -it \ | |
${pod_name} \ | |
-n ${use_namespace} \ | |
-- bash -c ". /opt/venv/bin/activate && sp -q 'index=\"antinex\" AND ${@}' -u trex -p 123321 -i antinex -a splunk-svc:8089 | grep -v urllib3.connectionpool" | |
# -- bash -c ". /opt/venv/bin/activate && echo \"sp -q 'index=\"antinex\" AND ${@}' -u trex -p 123321 -a splunk-svc:8089 | grep -v urllib3\" && sp -q '${@}' -u trex -p 123321 -i antinex -a splunk-svc:8089 | grep -v urllib3.connectionpool" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and