Skip to content

Instantly share code, notes, and snippets.

@DylanGraham
Created July 21, 2020 00:43
Show Gist options
  • Save DylanGraham/73ee54702e915645c0ff9faac734b4c7 to your computer and use it in GitHub Desktop.
Save DylanGraham/73ee54702e915645c0ff9faac734b4c7 to your computer and use it in GitHub Desktop.
Update kubectx short names after upgrade on MacOS
#!/bin/bash
local_dir="/usr/local/bin"
kctx_dir="/usr/local/Cellar/kubectx"
cd $kctx_dir
new_dir=$(find . -type d -d 1 -name "*\.*\.*" | sed 's/^\.\///')
rm -f latest
ln -s $new_dir latest
rm $local_dir/{kubectx,kubens,kctx,kns}
ln -s $kctx_dir/$new_dir/bin/kubectx $local_dir/kctx
ln -s $kctx_dir/$new_dir/bin/kubens $local_dir/kns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment