krew: Krew installation fails on Windows 10

I followed the instructions in the readme to install Krew on Windows. I get the following error:

PS >  .\krew-windows_amd64.exe install --manifest=..\krew.yaml --archive=..\krew
.zip

Installing plugin: krew
W0228 10:58:55.052380  158104 install.go:132] failed to install plugin "krew": failed to create a symlink form "C:\\Users\\my-user\\.krew\\bin" to "C:\\Users\\my-user\\.krew\\bin\\kubectl-krew.exe":
symlink C:\Users\my-user\.krew\store\krew\57788e8c7af1b5b000954455aa9ca2e4a18a50a020faf54d18a3ccf79ad04049\krew.exe C:\Users\my-user\.krew\bin\kubectl-krew.exe:
A required privilege is not held by the client.
F0228 10:58:55.182669  158104 root.go:52] failed to install some plugins: [krew]

I also tried with .\krew-windows_amd64.exe install --manifest="C:\Development\K8s\krew\krew.yaml" --archive="C:\Development\K8s\krew\krew.zip", same error.

Is there anything I’m missing?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 19 (8 by maintainers)

Most upvoted comments

A quick follow up.

If I run krew-install in an administrative powershell prompt, it installs but I get the same not supported by windows error

krew-windows_amd64.exe install --manifest krew.yaml --archive krew.zip
Installing plugin: krew
CAVEATS:
\
 |  krew is now installed! To start using kubectl plugins, you need to add
 |  krew's installation directory to your PATH:
 |
 |    * macOS/Linux:
 |      - Add the following to your ~/.bashrc or ~/.zshrc:
 |          export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
 |      - Restart your shell.
 |
 |    * Windows: Add %USERPROFILE%\.krew\bin to your PATH environment variable
 |
 |  Run "kubectl krew" to list krew commands and get help.
 |  You can find documentation at https://github.com/GoogleContainerTools/krew.
/
Installed plugin: krew
k krew help
not supported by windows

@ahmetb There’s not much to talk about with kubectl krew update

newfstatat(AT_FDCWD, "/home/jon/.krew/bin/kubectl-krew", {st_mode=S_IFREG|0755, st_size=10490849, ...}, 0) = 0
execve("/home/jon/.krew/bin/kubectl-krew", ["/home/jon/.krew/bin/kubectl-krew", "update"], 0xc000144750 /* 17 vars */) = -1 ENOMEM (Cannot allocate memory)
write(2</dev/tty1>, "cannot allocate memory\n", 23) = 23
exit_group(1)                           = ?

What’s interesting, is this seems to be intermittent? but once the cannot allocate memory error appears for a particular command, I have to restart WSL to clear it (I’ve not seen it recover without restarting WSL)

~$ k krew help
cannot allocate memory
~$ k krew update
cannot allocate memory
~$ k krew info
F0306 10:27:43.144134     734 root.go:52] requires at least 1 arg(s), only received 0
~$ k krew info
F0306 10:27:45.033008     747 root.go:52] requires at least 1 arg(s), only received 0
~$ k krew list
cannot allocate memory
~$ k krew info
cannot allocate memory

Here’s a strace of kubectl krew list working as we would expect, I’ve split it into 2 for brevity

newfstatat(AT_FDCWD, "/home/jon/.krew/bin/kubectl-krew", {st_mode=S_IFREG|0755, st_size=10490849, ...}, 0) = 0
execve("/home/jon/.krew/bin/kubectl-krew", ["/home/jon/.krew/bin/kubectl-krew", "list"], 0xc00012bcb0 /* 17 vars */) = 0
arch_prctl(ARCH_SET_FS, 0xd07ef0)       = 0
sched_getaffinity(0, 8192, [0, 1, 2, 3]) = 64
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8af7230000
mmap(0xc000000000, 67108864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
mmap(0xc000000000, 67108864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xc000000000
mmap(NULL, 33554432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8af5230000
mmap(NULL, 2162688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8af5020000
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8af5010000
clock_gettime(CLOCK_MONOTONIC, {tv_sec=16, tv_nsec=670926800}) = 0
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8af5000000

.....

newfstatat(AT_FDCWD, "/home/jon/.krew", {st_mode=S_IFDIR|0755, st_size=512, ...}, 0) = 0
newfstatat(AT_FDCWD, "/tmp/krew-downloads", {st_mode=S_IFDIR|0755, st_size=512, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/jon/.krew/store", {st_mode=S_IFDIR|0755, st_size=512, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/jon/.krew/bin", {st_mode=S_IFDIR|0755, st_size=512, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/jon/.krew/index/.git", 0xc0001826b8, 0) = -1 ENOENT (No such file or directory)
clock_gettime(CLOCK_REALTIME, {tv_sec=1551839442, tv_nsec=2159600}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=16, tv_nsec=725053800}) = 0
openat(AT_FDCWD, "/etc//localtime", O_RDONLY) = 3</etc/localtime>
read(3</etc/localtime>, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0"..., 4096) = 127
read(3</etc/localtime>, "", 4096)       = 0
close(3</etc/localtime>)                = 0
clock_gettime(CLOCK_REALTIME, {tv_sec=1551839442, tv_nsec=3956800}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=16, tv_nsec=726913800}) = 0
write(2</dev/tty1>, "F0306 10:30:42.002159      18 ro"..., 113) = 113

the write() was

F0306 10:30:42.002159 18 root.go:52] krew local plugin index is not initialized (run "kubectl krew update")

If I run kubectl krew list for a second time, I get cannot allocate memory

as for running on Windows directly…

  • I copied krew-windows_amd64.exe to my PATH
  • renamed krew-windows_amd64.exe to kubectl-krew.exe
  • kubectl plugin list The following kubectl-compatible plugins are available:

c:\tools\kubectl-krew.exe

  • try it out…

k version --client Client Version: version.Info{Major:“1”, Minor:“13”, GitVersion:“v1.13.0”, GitCommit:“ddf47ac13c1a9483ea035a79cd7c10005ff21a6d”, GitTreeState:“clean”, BuildDate:“2018-12-03T21:04:45Z”, GoVersion:“go1.11.2”, Compiler:“gc”, Platform:“windows/amd64”}

PS C:\Users\jonwa> k krew --help not supported by windows PS C:\Users\jonwa> k krew help not supported by windows PS C:\Users\jonwa> k krew list not supported by windows PS C:\Users\jonwa> k krew install not supported by windows

😕

opened https://github.com/kubernetes/kubectl/issues/603 . it also repros with the example foo plugin

@jon-walton do you mind opening an issue to https://github.com/kubernetes/kubectl with a minimal repro with one of those plugins (ideally without mentioning krew, since it’s not a krew issue).