When I try to install krew using krew.sigs.k8s.io instruction under WSL2:
(
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/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
And I got an error:
failed to list indexes: failed to list the remote URL for index default: command execution failure, output="": exit status 1
If that matter, my configuraiton is
kubectl is installed using multi-step kubernetes.io instrucitonkubectl version shows Client Version: v1.29.3git --version shows git version 2.43.0.windows.1which kubectl shows /usr/bin/kubectlzshI've seen https://github.com/kubernetes-sigs/krew/issues/706 but nothing helped from me there.
The issue was with git permissions and it was sovled with help of How to correct `git` reporting `detected dubious ownership in repository` without adding `safe.directory` when using WSL?
cd ~/.krew/index/default
git status
Output:
fatal: detected dubious ownership in repository at '//wsl.localhost/kali-linux/home/lislo/.krew/index/default'
To add an exception for this directory, call:
git config --global --add safe.directory '%(prefix)///wsl.localhost/kali-linux/home/lislo/.krew/index/default'
I've executed the proposed command and re-run installation of krew:
(
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/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
Now kubectl can see krew installed (I've modified path to avoid clashes with windows version of kubectl.exe):
$ PATH="/bin:$HOME/.krew/bin" kubectl plugin list
The following compatible plugins are available:
/home/lislo/.krew/bin/kubectl-krew
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With