Skip to content

Instantly share code, notes, and snippets.

@hermannolafs
Created September 18, 2025 08:09
Show Gist options
  • Save hermannolafs/260665e62235ff2843b8a8548fbc548c to your computer and use it in GitHub Desktop.
Save hermannolafs/260665e62235ff2843b8a8548fbc548c to your computer and use it in GitHub Desktop.
uses Tailscale CLI and Fzf to set the kube context in a really fancy cool way
function eks_context
set -l operator_choice (
tailscale status \
| awk '
/-operator/ {
name=$2;
status=substr($0, index($0,$5));
color = (status ~ /active/) ? "\033[32m" : \
(status ~ /offline/) ? "\033[31m" : "\033[90m";
printf "%s\t%s%s\033[0m\n", name, color, status
}' \
| fzf --ansi --delimiter='\t' --with-nth=1,2 --nth=1 \
| cut -f1
)
test -n "$operator_choice"; or return
tailscale configure kubeconfig {$operator_choice}
kubectl config use-context {$operator_choice}.tailae5e.ts.net
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment