First make sure you have git installed
Then use the following command
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" &&
tar zxvf krew.tar.gz &&
KREW=./krew-"${OS}_${ARCH}" &&
"$KREW" install krew
)
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
kubectl krew
Kubectl Krew update # update
Kubectl Krew search # displays all plug-ins
Kubectl Krew install view secret # installs a plug-in named view secret
Kubectl view secret # uses this plug-in
Kubectl Krew upgrade # upgrade installed plug-ins
Kubectl Krew remove view secret # uninstall plug-in