Kubectl: Windows 10 WSL - "cannot allocate memory" when calling a plugin

Created on 9 Mar 2019  路  11Comments  路  Source: kubernetes/kubectl

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): no

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): windows; allocate


Is this a BUG REPORT or FEATURE REQUEST? (choose one): bug report

Kubernetes version (use kubectl version): Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.3", GitCommit:"721bfa751924da8d1680787490c54b9179b1fed0", GitTreeState:"clean", BuildDate:"2019-02-01T20:08:12Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release): Windows 10.0.17763 / Ubuntu 18.04.2 LTS
  • Kernel (e.g. uname -a): Linux DESKTOP-3I1L0FQ 4.4.0-17763-Microsoft #253-Microsoft Mon Dec 31 17:49:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Install tools:
  • Others:

What happened:

kubectl often returns cannot allocate memory instead of executing a plugin. Calling the plugin directly always works.

What you expected to happen:

calling the plugin via kubectl to work as if called directly

How to reproduce it (as minimally and precisely as possible):

Use the example plugin from https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/#example-plugin

$ k plugin list
The following kubectl-compatible plugins are available:

/home/jon/.kube/plugins/kubectl-foo

kubectl often returns cannot allocate memory instead of executing the plugin.

$ k foo
cannot allocate memory
$ k foo version
1.0.0
$ k foo version
cannot allocate memory
$ k foo version
cannot allocate memory
$ k foo
cannot allocate memory
$ k foo
cannot allocate memory
$ k foo
cannot allocate memory
$ k foo
cannot allocate memory
$ k foo
I am a plugin named kubectl-foo
$ k foo
cannot allocate memory

executing the plugin directly always works

$ kubectl-foo version
1.0.0
$ kubectl-foo
I am a plugin named kubectl-foo
$ kubectl-foo version
1.0.0
$ kubectl-foo version
1.0.0
$ kubectl-foo version
1.0.0
$ kubectl-foo version
1.0.0
$ kubectl-foo version
1.0.0

Anything else we need to know:

This also happens with windows compatible plugins when called directly from Windows 10, rather then WSL; however it's easier for me to provide details using linux tooling.

Here's a strace -o kubectl -ff -y kubectl foo version
kubectl.zip

arekubectl kinbug sicli

Most helpful comment

I just updated to Windows 10 1903 (10.0.18362) and can no longer reproduce this under WSL.

Can anyone else confirm?

Updating Windows 10 did not fix the issue for me. Still getting not supported by windows
If I use kubectl-krew (with the dash) it does work however.

All 11 comments

Here's a strace -o kubectl -ff -y kubectl foo version of it working
kubectl-works.zip

I am also having issue installing Krew on Windows and got here from https://github.com/kubernetes-sigs/krew/issues/156
@jon-walton Looking at the description, error message you have are for Linux. For windows I see following

PS C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin> kubectl krew --help
not supported by windows
PS C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin>

I tried different plugins but same error. kubectl version is this:

Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.3", GitCommit:"721bfa751924da8d1680787490c54b9179b
1fed0", GitTreeState:"clean", BuildDate:"2019-02-01T20:08:12Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"windows/amd64"}

Windows version: Microsoft Windows Server 2012 R2 Datacenter

kubectl calls Exec which on windows returns error (https://golang.org/src/syscall/exec_windows.go)
May be kubectl should be using StartProcess instead of Exec on Windows.

Also getting not supported by windows:

PS C:\krew-temp\krew> kubectl krew
not supported by windows

Ran the following command in an elevated PowerShell and it installed successfully:

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

kubectl version:

clientVersion:
  buildDate: "2019-03-25T15:53:57Z"
  compiler: gc
  gitCommit: 641856db18352033a0d96dbc99153fa3b27298e5
  gitTreeState: clean
  gitVersion: v1.14.0
  goVersion: go1.12.1
  major: "1"
  minor: "14"
  platform: windows/amd64
serverVersion:
  buildDate: "2019-03-25T06:30:48Z"
  compiler: gc
  gitCommit: 16236ce91790d4c75b79f6ce96841db1c843e7d2
  gitTreeState: clean
  gitVersion: v1.11.9
  goVersion: go1.10.8
  major: "1"
  minor: "11"
  platform: linux/amd64

Windows version:

Windows 10 Pro

Got here from https://github.com/kubernetes-sigs/krew/issues/156

Installed krew version:

https://github.com/kubernetes-sigs/krew/releases/tag/v0.2.1

/sig cli
/area kubectl
/kind bug

I just updated to Windows 10 1903 (10.0.18362) and can no longer reproduce this under WSL.

Can anyone else confirm?

I can't run any plugin on Windows. I'm using kubectl 1.15.2* on Windows 10 Enterprise 1903 Version 10.0.18362.295 and it always fails with

not supported by windows

@spacecat, are you still seeing this?

* Downloaded from https://storage.googleapis.com/kubernetes-release/release/v1.15.2/bin/windows/amd64/kubectl.exe

EDIT: I see the fix for this bug is in the 1.16 branch. Never mind, I spoke too soon.

I just updated to Windows 10 1903 (10.0.18362) and can no longer reproduce this under WSL.

Can anyone else confirm?

Updating Windows 10 did not fix the issue for me. Still getting not supported by windows
If I use kubectl-krew (with the dash) it does work however.

Experiencing this under Windows 10 (10.0.17763) and kubectl 1.19, getting cannot allocate memory for most calls as described by the OP

me too for
kubectl krew list
same versions

Windows 10 1809 and WSL1, most of krew calls I get "cannot allocate memory". I'm using ConEmu terminal.

Was this page helpful?
0 / 5 - 0 ratings