Merge pull request #8519 from Harkishen-Singh/tip-for-minikube-based-kubectl-usage

Adds better information for using kubectl inside minikube
pull/8529/head
Medya Ghazizadeh 2020-06-22 12:01:06 -07:00 committed by GitHub
commit c609b3fd48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

View File

@ -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
}

View File

@ -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 -- <kubectl commands>`
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`