Add some k8s utilities
This commit is contained in:
parent
f5a073e428
commit
4f0cfb9d1f
2 changed files with 11 additions and 0 deletions
3
bin/kube-setns
Executable file
3
bin/kube-setns
Executable 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
8
bin/kube-sh
Executable 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
|
||||
|
Loading…
Reference in a new issue