Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to install krew: failed to list the remote URL for index default [closed]

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

  • Windows 11
  • WSL2 with Kali Linux
  • kubectl is installed using multi-step kubernetes.io instruciton
  • kubectl version shows Client Version: v1.29.3
  • git --version shows git version 2.43.0.windows.1
  • which kubectl shows /usr/bin/kubectl
  • zsh

I've seen https://github.com/kubernetes-sigs/krew/issues/706 but nothing helped from me there.

like image 479
Igor Golovin Avatar asked Oct 24 '25 14:10

Igor Golovin


1 Answers

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
like image 53
Igor Golovin Avatar answered Oct 26 '25 05:10

Igor Golovin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!