Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krew installation fails on Windows 10 #156

Closed
juv opened this issue Feb 28, 2019 · 19 comments
Closed

Krew installation fails on Windows 10 #156

juv opened this issue Feb 28, 2019 · 19 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@juv
Copy link

juv commented Feb 28, 2019

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?

@ahmetb
Copy link
Member

ahmetb commented Feb 28, 2019

Not a known issue. But if you search for “A required privilege is not held by the client.“ it seems like it’s a machine issue. Perhaps something like a policy is preventing you.

@juv
Copy link
Author

juv commented Feb 28, 2019

@ahmetb it looks like creating a symlink is requiring special permissions on the machine (golang/dep#773 is similar). I do not have those. Is it possible to have a switch to copy the files instead of creating a symlink?

Can I solve this manually? What do I need to copy where?

@ahmetb
Copy link
Member

ahmetb commented Feb 28, 2019

creating a symlink is requiring special permissions on the machine

I think we tried this on windows and it was working. Do you have any data points on os.Symlink go function generally not working on most windows machines?

What do I need to copy where?

The error shows you the two paths you need to copy. Copy the one in .krew\store... to .krew\bin... path that's listed in the error.

@ahmetb ahmetb added the kind/bug Categorizes issue or PR as related to a bug. label Feb 28, 2019
@juv
Copy link
Author

juv commented Feb 28, 2019

@ahmetb Which is the second path are you referring to?

I have copied
C:\Users\my-user\.krew\store\krew\57788e8c7af1b5b000954455aa9ca2e4a18a50a020faf54d18a3ccf79ad04049\krew.exe
to: C:\Users\my-user\.krew\bin\kubectl-krew.exe

I added the folder %USERPROFILE%\.krew\bin to my path.

kubectl plugin list shows no plugins though:
PS C:\Development\Git> kubectl plugin list error: no plugins installed.

@ahmetb
Copy link
Member

ahmetb commented Feb 28, 2019

Try installing any kubectl plugin without krew and see if that works.

Right now you're potentially reporting a kubectl bug (issues with the plugin mechanism) and this is not the correct repo for that.

@rnarayana
Copy link

rnarayana commented Mar 4, 2019

Is it manifest= or source= ? The installation instructions (https://github.com/GoogleContainerTools/krew/blob/v0.2.1/README.md) specifies 'source' but it fails on windows with the error "F0304 20:06:42.638733 1884 root.go:52]unknown flag: --source"

Edit: It works with manifest, but once installed, it shows the error:
D:\temp>kubectl krew
not supported by windows

@ahmetb
Copy link
Member

ahmetb commented Mar 4, 2019

Should be --manifest. I think the readme was wrong so it’s changed post-v0.2.1.

@jon-walton
Copy link

jon-walton commented Mar 5, 2019

I'm having the same problem (on Windows 10 directly and with WSL)

:~$ 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
:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
(
>   set -x; cd "$(mktemp -d)" &&
>   curl -fsSLO "https://storage.googleapis.com/krew/v0.2.1/krew.{tar.gz,yaml}" &&
>   tar zxvf krew.tar.gz &&
>   strace -o krew.txt -ff -y ./krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" install \
>     --manifest=krew.yaml --archive=krew.tar.gz
> )
++ mktemp -d
+ cd /tmp/tmp.ilNM6TCxYZ
+ curl -fsSLO 'https://storage.googleapis.com/krew/v0.2.1/krew.{tar.gz,yaml}'
+ tar zxvf krew.tar.gz
./krew-darwin_amd64
./krew-linux_amd64
./krew-linux_arm
./krew-windows_amd64.exe
++ uname
++ tr '[:upper:]' '[:lower:]'
+ ./krew-linux_amd64 install --manifest=krew.yaml --archive=krew.tar.gz
Installing plugin: krew
W0305 22:24:37.282241      73 install.go:132] failed to install plugin "krew": failed to dowload and move during installation: could not rename file from "/tmp/krew-temp-move493619428" to "/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a": rename /tmp/krew-temp-move493619428 /home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a: permission denied
F0305 22:24:37.286039      73 root.go:52] failed to install some plugins: [krew]

and here's a partial strace

mkdirat(AT_FDCWD, "/tmp/krew-temp-move237334595", 0700) = 0
newfstatat(AT_FDCWD, "/tmp/krew-downloads/krew/krew-linux_amd64", {st_mode=S_IFREG|0755, st_size=10490849, ...}, 0) = 0
newfstatat(AT_FDCWD, "/tmp/krew-temp-move237334595", {st_mode=S_IFDIR|0700, st_size=512, ...}, 0) = 0
lstat("/tmp/krew-temp-move237334595/krew", 0xc000087078) = -1 ENOENT (No such file or directory)
renameat(AT_FDCWD, "/tmp/krew-downloads/krew/krew-linux_amd64", AT_FDCWD, "/tmp/krew-temp-move237334595/krew") = 0
newfstatat(AT_FDCWD, "/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a", 0xc0000873b8, 0) = -1 ENOENT (No such file or directory)
lstat("/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a", 0xc000087488) = -1 ENOENT (No such file or directory)
renameat(AT_FDCWD, "/tmp/krew-temp-move237334595", AT_FDCWD, "/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a") = -1 EACCES (Permission denied)
unlinkat(AT_FDCWD, "/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a", 0) = -1 ENOENT (No such file or directory)
unlinkat(AT_FDCWD, "/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a", AT_REMOVEDIR) = -1 ENOENT (No such file or directory)
unlinkat(AT_FDCWD, "/tmp/krew-temp-move237334595", 0) = -1 EISDIR (Is a directory)
unlinkat(AT_FDCWD, "/tmp/krew-temp-move237334595", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
lstat("/tmp/krew-temp-move237334595", {st_mode=S_IFDIR|0700, st_size=512, ...}) = 0
openat(AT_FDCWD, "/tmp/krew-temp-move237334595", O_RDONLY|O_CLOEXEC) = 8</tmp/krew-temp-move237334595>
epoll_ctl(4</unknown>, EPOLL_CTL_ADD, 8</tmp/krew-temp-move237334595>, {EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, {u32=1051020224, u64=140729949440960}}) = 0
fcntl(8</tmp/krew-temp-move237334595>, F_GETFL) = 0 (flags O_RDONLY)
fcntl(8</tmp/krew-temp-move237334595>, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
getdents64(8</tmp/krew-temp-move237334595>, /* 3 entries */, 8192) = 72
getdents64(8</tmp/krew-temp-move237334595>, /* 0 entries */, 8192) = 0
epoll_ctl(4</unknown>, EPOLL_CTL_DEL, 8</tmp/krew-temp-move237334595>, 0xc0000ba4fc) = 0
close(8</tmp/krew-temp-move237334595>)  = 0
unlinkat(AT_FDCWD, "/tmp/krew-temp-move237334595/krew", 0) = 0
unlinkat(AT_FDCWD, "/tmp/krew-temp-move237334595", 0) = -1 EISDIR (Is a directory)
unlinkat(AT_FDCWD, "/tmp/krew-temp-move237334595", AT_REMOVEDIR) = 0
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew", 0) = -1 EISDIR (Is a directory)
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
lstat("/tmp/krew-downloads/krew", {st_mode=S_IFDIR|0755, st_size=512, ...}) = 0
openat(AT_FDCWD, "/tmp/krew-downloads/krew", O_RDONLY|O_CLOEXEC) = 8</tmp/krew-downloads/krew>
epoll_ctl(4</unknown>, EPOLL_CTL_ADD, 8</tmp/krew-downloads/krew>, {EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, {u32=1051020224, u64=140729949440960}}) = 0
fcntl(8</tmp/krew-downloads/krew>, F_GETFL) = 0 (flags O_RDONLY)
fcntl(8</tmp/krew-downloads/krew>, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
getdents64(8</tmp/krew-downloads/krew>, /* 5 entries */, 8192) = 176
getdents64(8</tmp/krew-downloads/krew>, /* 0 entries */, 8192) = 0
epoll_ctl(4</unknown>, EPOLL_CTL_DEL, 8</tmp/krew-downloads/krew>, 0xc0000ba69c) = 0
close(8</tmp/krew-downloads/krew>)      = 0
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew/krew-darwin_amd64", 0) = 0
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew/krew-linux_arm", 0) = 0
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew/krew-windows_amd64.exe", 0) = 0
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew", 0) = -1 EISDIR (Is a directory)
unlinkat(AT_FDCWD, "/tmp/krew-downloads/krew", AT_REMOVEDIR) = 0

a manual installation seems to work, but I seem to hit some other incompatibility?

~$ ln ~/krew-linux_amd64 ~/.krew/bin/kubectl-krew
~$ kubectl plugin list
The following kubectl-compatible plugins are available:

/home/jon/.krew/bin/kubectl-krew
~$ kubectl krew
cannot allocate memory
~$ kubectl krew --help
krew is the kubectl plugin manager.
You can invoke krew through kubectl: "kubectl krew [command]..."

Usage:
  krew [command]

Available Commands:
  help        Help about any command
  info        Show information about a kubectl plugin
  install     Install kubectl plugins
  list        List installed plugins
  remove      Uninstall plugins
  search      Discover kubectl plugins
  update      Update the local copy of the plugin index
  upgrade     Upgrade installed plugins to newer versions
  version     Show krew version and diagnostics

Flags:
  -h, --help      help for krew
  -v, --v Level   log level for V logs

Use "krew [command] --help" for more information about a command.
~$ kubectl krew help
cannot allocate memory
~$ kubectl krew version
OPTION          VALUE
IsPlugin        false
ExecutedVersion
GitTag          v0.2.1
GitCommit       cd2c6e1
IndexURI        https://github.com/GoogleContainerTools/krew-index.git
BasePath        /home/jon/.krew
IndexPath       /home/jon/.krew/index
InstallPath     /home/jon/.krew/store
DownloadPath    /tmp/krew-downloads
BinPath         /home/jon/.krew/bin
~$ kubectl krew search
F0305 22:55:48.102574     468 root.go:52] krew local plugin index is not initialized (run "kubectl krew update")
~$ kubectl krew update
cannot allocate memory
~$ kubectl version --client
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"}

@ahmetb
Copy link
Member

ahmetb commented Mar 5, 2019

@jon-walton thanks for detailing these out. I think this is a legit bug. I'm surprised Go's os.Symlink code did not work on native Windows execution.

In your case I'm seeing the installation error is actually different:

failed to install plugin "krew": failed to dowload and move during installation: could not rename file from "/tmp/krew-temp-move493619428" to "/home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a": rename /tmp/krew-temp-move493619428 /home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a: permission denied

Similarly, the cannot allocate memory error is very puzzling to me. From the strace, it looks like you are actually running krew-linux-amd64 binary on WSL, which should work. This sounds like it might be a Golang on WSL memory corruption issue.

Can you provide strace for kubectl krew update as well?


I'm gonna keep this open for tracking. I have no idea on where to start, or a windows machine to try things right now. Any contributions/help welcome.

@jon-walton
Copy link

jon-walton commented Mar 6, 2019

@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

😕

@rnarayana
Copy link

Ditto for me on WSL ubuntu and on win 10.

@jon-walton
Copy link

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

@jon-walton
Copy link

I don't think the cannot allocate memory is related to krew

installing https://github.com/jordanwilson230/kubectl-plugins

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

/home/jon/.krew/bin/kubectl-krew
/home/jon/.kube/plugins/jordanwilson230/kubectl-image
/home/jon/.kube/plugins/jordanwilson230/kubectl-ip
/home/jon/.kube/plugins/jordanwilson230/kubectl-prompt
/home/jon/.kube/plugins/jordanwilson230/kubectl-ssh
/home/jon/.kube/plugins/jordanwilson230/kubectl-switch
/home/jon/.kube/plugins/jordanwilson230/kubectl-uptime

$ k uptime
cannot allocate memory

@juv I also received the error A required privilege is not held by the client. when trying to install directly in Windows. Have you tried again using an administrative powershell prompt?

@jon-walton
Copy link

this seems to definitely be a kubectl issue?

$ ll ~/.krew/bin
total 0
drwxr-xr-x 1 jon jon 512 Mar  6 11:20 ./
drwxr-xr-x 1 jon jon 512 Mar  6 11:18 ../
lrwxrwxrwx 1 jon jon 104 Mar  6 11:20 kubectl-krew -> /home/jon/.krew/store/krew/dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a/kubectl-krew*

$ kubectl-krew update
Updated the local copy of plugin index.

$ kubectl-krew list
PLUGIN VERSION
krew   dc2f2e1ec8a0acb6f3e23580d4a8b38c44823e948c40342e13ff6e8e12edb15a

$ kubectl-krew search
NAME                           DESCRIPTION                                        STATUS
access-matrix                  Show an access matrix for all resources            available
bulk-action                    Do bulk actions on Kubernetes resources.           available
ca-cert                        Print the PEM CA certificate of the current clu... available
change-ns                      View or change the current namespace via kubectl.  available
cssh                           SSH into Kubernetes nodes                          available
debug-shell                    Create pod with interactive kube-shell.            available
exec-all                       Execute a command in all of the containers in a... available
exec-as                        Like kubectl exec, but offers a `user` flag to ... available
get-all                        Like 'kubectl get all', but _really_ everything    available
gke-credentials                Fetch credentials for GKE clusters                 available
krew                           Package manager for kubectl plugins.               installed
kubesec-scan                   Scan Kubernetes resources with kubesec.io.         available
match-name                     Match names of pods and other API objects          available
mtail                          Tail logs from multiple pods matching label sel... available
node-admin                     List nodes and run privileged pod with chroot      available
open-svc                       Open the Kubernetes URL(s) for the specified se... available
pod-logs                       Display a list of pods to get logs from            available
pod-shell                      Display a list of pods to execute a shell in       available
prompt                         Prompts for user confirmation when executing co... available
rbac-lookup                    Reverse lookup for RBAC                            available
rbac-view                      A tool to visualize your RBAC permissions.         available
resource-capacity              Provides an overview of resource requests, limi... available
restart                        Restarts a pod with the given name                 available
rm-standalone-pods             Remove all pods without owner references           available
sniff                          easly start a remote packet capture on kubernet... available
ssh-jump                       A kubectl plugin to SSH into Kubernetes nodes u... available
sudo                           Run Kubernetes commands impersonated as group s... available
view-secret                    Decode secrets                                     available
view-serviceaccount-kubeconfig Show a kubeconfig setting to access the apiserv... available
view-utilization               Shows cluster cpu and memory utilization           available
warp                           Sync and execute local files in Pod                available

$ kubectl-krew install sniff
Updated the local copy of plugin index.
Installing plugin: sniff
CAVEATS:
\
 |  This plugin needs the following programs:
 |  * wireshark (optional, used for live capture)
/
Installed plugin: sniff

$ kubectl-sniff
Usage:
  sniff pod [-n namespace] [-c container] [-f filter] [-o output-file] [-l local-tcpdump-path] [-r remote-tcpdump-path] [flags]

Examples:
kubectl sniff hello-minikube-7c77b68cff-qbvsd -c hello-minikube

Flags:
  -c, --container string             container (optional)
  -f, --filter string                filter (optional)
  -h, --help                         help for sniff
  -l, --local-tcpdump-path string    local static tcpdump binary path (optional)
  -n, --namespace string             namespace (optional) (default "default")
  -o, --output-file string           output file path, tcpdump output will be redirect to this file instead of wireshark (optional)
  -r, --remote-tcpdump-path string   remote static tcpdump binary path (optional) (default "/tmp/static-tcpdump")
  -v, --verbose                      if specified, ksniff output will include debug information (optional)
Error: not enough arguments

$ ~/.krew/bin/kubectl-sniff my-pod -n my-ns
INFO[0000] using tcpdump path at: '/home/jon/.krew/store/sniff/6250c1cf8fcf70fa4a946ca9ff70c74b8372f1c744d9bef214a5567970e7e7d4/static-tcpdump'
INFO[0000] no container specified, taking first container we found in pod.
INFO[0000] selected container: 'my-container'
INFO[0000] sniffing on pod: 'my-pod' [namespace: 'my-ns', container: 'my-container', filter: '']
INFO[0000] checking for static tcpdump binary on: '/tmp/static-tcpdump'
INFO[0002] couldn't find static tcpdump binary on: '/tmp/static-tcpdump', starting to upload
INFO[0006] verifying tcpdump uploaded successfully
INFO[0008] static-tcpdump found: '-rwxr-xr-x    1 root     root       2642872 Jan  1  1970 /tmp/static-tcpdump
'
INFO[0008] tcpdump uploaded successfully
INFO[0008] spawning wireshark!

@ahmetb
Copy link
Member

ahmetb commented Mar 6, 2019

@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).

@jon-walton
Copy link

opened kubernetes/kubectl#603 . it also repros with the example foo plugin

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 7, 2019
@ahmetb
Copy link
Member

ahmetb commented Jun 7, 2019

/close
since it's being tracked on kubectl repo.

@k8s-ci-robot
Copy link
Contributor

@ahmetb: Closing this issue.

In response to this:

/close
since it's being tracked on kubectl repo.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

6 participants