Running internal kubectl command when minikube is called as 'kubectl'
Fixes issue #8857 Signed-off-by: Pablo Caderno <kaderno@gmail.com>pull/8872/head
parent
7257b9b295
commit
10a3f2e2a8
|
@ -20,6 +20,7 @@ import (
|
|||
goflag "flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
|
@ -73,6 +74,10 @@ var RootCmd = &cobra.Command{
|
|||
// Execute adds all child commands to the root command sets flags appropriately.
|
||||
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
||||
func Execute() {
|
||||
_, callingCmd := filepath.Split(os.Args[0])
|
||||
if callingCmd == "kubectl" {
|
||||
os.Args = append([]string{"minikube", callingCmd}, os.Args[1:]...)
|
||||
}
|
||||
for _, c := range RootCmd.Commands() {
|
||||
c.Short = translate.T(c.Short)
|
||||
c.Long = translate.T(c.Long)
|
||||
|
|
|
@ -29,3 +29,8 @@ minikube's bootstrapper, [Kubeadm](https://github.com/kubernetes/kubeadm) verifi
|
|||
Please allocate sufficient resources for Knative setup using minikube, especially when you run a minikube cluster on your local machine. We recommend allocating at least 6 CPUs and 8G memory.
|
||||
|
||||
`minikube start --cpus 6 --memory 8000`
|
||||
|
||||
## Do I need to install kubectl locally?
|
||||
|
||||
No, minikube comes with built-in kubectl [see minikube's kubectl documentation]({{< ref "docs/handbook/kubectl.md"}}).
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ as well.
|
|||
|
||||
You can also `alias kubectl="minikube kubectl --"` for easier usage.
|
||||
|
||||
Alternatively, you can create a symbolic link to minikube's binary named 'kubectl'.
|
||||
|
||||
`ln -s $(which minikube) /usr/local/bin/kubectl`
|
||||
|
||||
Get pods
|
||||
|
||||
`minikube kubectl -- get pods`
|
||||
|
|
Loading…
Reference in New Issue