diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 69bc06e60e..74071abac3 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -369,6 +369,8 @@ func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName st path, err := exec.LookPath("kubectl") if err != nil { + out.ErrT(out.Kubectl, "Kubectl not found in your path") + out.ErrT(out.Workaround, "You can use kubectl inside minikube. For more information, visit https://minikube.sigs.k8s.io/docs/handbook/kubectl/") out.ErrT(out.Tip, "For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/") return nil } diff --git a/site/content/en/docs/handbook/kubectl.md b/site/content/en/docs/handbook/kubectl.md new file mode 100644 index 0000000000..be53d6af68 --- /dev/null +++ b/site/content/en/docs/handbook/kubectl.md @@ -0,0 +1,34 @@ +--- +title: "Kubectl" +weight: 2 +description: > + Use kubectl inside minikube +aliases: + - /docs/kubectl/ +--- + +By default, [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) gets configured to access the kubernetes cluster control plane +inside minikube when the `minikube start` command is executed. + +However if `kubectl` is not installed locally, kubectl can be used inside the minikube +as well. + +`minikube kubectl -- ` + +You can also `alias kubectl=minikube kubectl --` for easier usage. + +Get pods + +`minikube kubectl -- get pods` + +Creating a deployment inside kubernetes cluster + +`minikube kubectl -- create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4` + +Exposing the deployment with a NodePort service + +`minikube kubectl -- expose deployment hello-minikube --type=NodePort --port=8080` + +For more help + +`minikube kubectl -- --help`