-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathk8s.fish
More file actions
19 lines (16 loc) · 858 Bytes
/
k8s.fish
File metadata and controls
19 lines (16 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if type -q kubectl
function kpods --argument-names podsname namespace --description="Search for pods"
kubectl get pods -n $namespace --no-headers | grep $podsname
end
function klogs --argument-names podname namespace cmd --description="Tail logs of a pod"
set podname (kpods $podname $namespace | awk '{print $1}' | awk -F'-' 'NF==4' | head -n 1)
kubectl logs -f $podname -n $namespace
end
function kexec --argument-names podname namespace cmd --description="Execute a one-time command"
kubectl exec -it $podname -n $namespace -- $argv[3..]
end
function krails --argument-names podname namespace --description="Run Rails console"
set podname (kpods $podname $namespace | awk '{print $1}' | awk -F'-' 'NF==4' | head -n 1)
kexec $podname $namespace bundle exec rails c
end
end