user674669
user674669

Reputation: 12392

Why is Visual Studio Code not finding my kubectl binary?

I restarted my mac (Mac OS High Sierra) and now Visual Studio code can't find kubectl binary even it is installed via brew.

$ which kubectl
/usr/local/bin/kubectl

enter image description here

The weird thing is that it could find kubectl before I restarted my laptop.

Upvotes: 6

Views: 3950

Answers (2)

Mehrdad Qasemkhani
Mehrdad Qasemkhani

Reputation: 139

Find your "settings.json" file, first.

Edit the values of these two keys:

    "vs-kubernetes": {
        .
        "vs-kubernetes.kubectl-path.${your-os}": "/usr/local/bin/kubectl",
        .
        .
        "vscode-kubernetes.kubectl-path-${your-os}": "/usr/local/bin/kubectl",
        .
    },

Tips:

  • Find your kubectl path in unix-like OS with $ which kubectl command
  • Possible value for ${your-os} var are:
    • for GNU/Linux is linux
    • for macOS is mac
    • for windows is windows

Upvotes: 1

psadi
psadi

Reputation: 184

adding the below config is vscode settings.json may resolve this

"vs-kubernetes": {
    "vscode-kubernetes.minikube-path.mac": "/path/to/minikube",
    "vscode-kubernetes.kubectl-path.mac": "/path/to/kubectl",
    "vscode-kubernetes.helm-path.mac" : "/path/to/helm"
}

Upvotes: 4

Related Questions