question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: kubectl not found

See original GitHub issue

System Information:

  • MacOS: 10.15.7
  • VSCode: 1.60.0
  • Kubernetes Extension: v1.3.3

Recently I started having an issue where the extension cannot find kubectl on VSCode launch. I get an error saying

Kubectl command failed: kubectl not found

In my settings, I have tried setting both vscode-kubernetes.kubectl-path as well as vscode-kubernetes.kubectl-path.mac to a specific path and it is giving the same error. E.g.

"vscode-kubernetes.kubectl-path": "/usr/local/bin/kubectl"

And /usr/local/bin/kubectl is the same path I get when I run which kubectl

I am using settings sync but this particular setting is ignored so nothing should be stepping on top of it.

I have also not been able to find any specific logs for this extension loading but not sure if I am looking in the correct place or not.

In addition, I have installed kubectl to the local default directory used by the extension at ~/.vs-kubernetes/tools as well but that has not fixed the issue.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SMFloriscommented, Mar 22, 2022

We are having the same issue when using microk8s as well.

For example, in theory it would be enough to point it to the kubectl path:

"vscode-kubernetes.kubectl-path": "/var/lib/snapd/snap/bin/microk8s.kubectl",

But this fails since it expects the binary itself to be named kubectl and does not accept anything else which defeats the purpose of the path variable.

0reactions
onelaviewcommented, Nov 10, 2022
  • OS: macOS 12.6 / ARM
  • kubectl installed via Homebrew at /opt/homebrew/bin/kubectl and is on system PATH.
  • Extension version v1.3.10

Found similar issue. I’ve got this error notification when opening kubeconfig file (i.e. /Users/foo/.kube/config) in my vscode.

image

In my case, I don’t have vs-kubernetes.kubectl-path or vscode-kubernetes.kubectl-path settings whatsoever. Only related extension setting is

"vs-kubernetes": {
    "vscode-kubernetes.minikube-path.mac": "/Users/foo/.vs-kubernetes/tools/minikube/darwin-amd64/minikube"
},

I solved this by deleting ~/.vs-kubernetes folder, uninstall the extension and then re-install it. Now the error notification doesn’t popup anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kubernetes: kubectl run: command not found - Stack Overflow
I get the error: -bash: kubectl: command not found. Here's how I fixed it: Download the latest Kubernetes release with the command:
Read more >
Install and Set Up kubectl on Linux - Kubernetes
The following methods exist for installing kubectl on Linux: Install kubectl binary with curl on Linux; Install using native package management ...
Read more >
"kubectl" command not found error.. · Issue #18 - GitHub
Do you have kubectl avaialable on the host and placed in executable path? Kube-shell does not install kubectl.
Read more >
Kubernetes Error Codes: Container Not Found | Datree.io
The `container not found` error code generally indicates that kubectl can't establish communication with the pod or container you are trying to ...
Read more >
Troubleshoot kubectl issues - Bitnami Documentation
Error 1: kubectl does not permit access to certain resources. This occurs when you run the kubectl command and see the following error:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found