Add some k8s utilities

This commit is contained in:
Daniel Lundin 2018-02-22 12:26:29 +01:00 committed by Daniel Lundin
parent f5a073e428
commit 4f0cfb9d1f
2 changed files with 11 additions and 0 deletions

3
bin/kube-setns Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
set -xeuo pipefail
kubectl config set-context $(kubectl config current-context) --namespace "$1"

8
bin/kube-sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -xe
ns=$1
shift
selector="$@"
pod=$(kubectl get pods --namespace=$ns $selector -o template --template="{{with index .items 0}}{{.metadata.name}}{{end}}")
exec kubectl --namespace=$ns exec -ti $pod /bin/sh