1

I installed minikube in Windows 10 . I am able to start minikube

**C:\WINDOWS\system32>minikube start
* minikube v1.15.1 on Microsoft Windows 10 Pro 10.0.18363 Build 18363
* Using the hyperv driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing hyperv VM for "minikube" ...
* Preparing Kubernetes v1.19.4 on Docker 19.03.13 ...
* Verifying Kubernetes components...
* Enabled addons: storage-provisioner, default-storageclass
* kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default**

But there is a warning in above output ( 2nd last line ) says kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'

After that I executed this command too minikube kubectl -- get pods -A

Still getting below error while trying kubectl

C:\WINDOWS\system32>kubectl
'kubectl' is not recognized as an internal or external command,
operable program or batch file.
Arun
  • 1,131
  • 2
  • 13
  • 27

4 Answers4

2

You have installed minikube, kubectl is not a part of minikube package.

It says when you do minikube start that kubectl is not present and if you need to you can use minikube kubectl instead.

This is also mentioned here

If you already have kubectl installed, you can now use it to access your shiny new cluster
Discombobulate
  • 263
  • 2
  • 8
1

It means that the kubectl might not be present on your machine or that it is not added to your PATH.

You can follow these instructions to install it either by downloading executable or by using curl:

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/windows/amd64/kubectl.exe

After that add the binary to PATH.

You can run kubectl version --client to ensure correct version is downloaded.

Mariusz K.
  • 1,972
  • 1
  • 5
  • 14
  • 1
    It is installed inside of `minikube` and can be accessed via `minikube kubectl --` e.g. `minikube kubectl -- version --client` – Vladimir Iashin Feb 09 '21 at 09:15
1

Had the same problem on Linux.

minikube kubectl -- get po -A
kubectl version --client
  zsh: command not found: kubectl

Minikube installs kubectl inside of itself. Therefore, you cannot just run the command kubectl.

To use the kubectl which you installed via minikube, you have to prepend the command arguments with minikube kubectl --. For example:

# the same as `kubectl version --client`
minikube kubectl -- version --client

For convenience, you may want to add an alias in your shell configuration.

Source: https://minikube.sigs.k8s.io/docs/handbook/kubectl/

Vladimir Iashin
  • 489
  • 6
  • 14
1

kubectl is wrapped around minikube.

Don't forget to add a -- after minikube kubectl

minikube kubectl -- describe pod kube-scheduler-minikube --namespace kube-system
minikube kubectl -- get pods --namespace kube-system
Yatin
  • 2,348
  • 6
  • 20
  • 38
spk104
  • 11
  • 1