Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discussion: minikube kubectl #4684

Closed
josedonizetti opened this issue Jul 4, 2019 · 4 comments
Closed

discussion: minikube kubectl #4684

josedonizetti opened this issue Jul 4, 2019 · 4 comments
Labels
cmd/kubectl Issues with the "kubectl" command

Comments

@josedonizetti
Copy link
Member

The command minikube kubectl has a lot of problems. Any flag that you pass to it won't work because corba will try to parse it, eg:

minikube kubectl logs -f my-pod
Error: unknown shorthand flag: 'f' in -f
Usage:
  minikube kubectl [flags]

Flags:
  -h, --help   help for kubectl

Global Flags:
      --alsologtostderr                  log to standard error as well as files
  -b, --bootstrapper string              The name of the cluster bootstrapper that will set up the kubernetes cluster. (default "kubeadm")
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files
  -p, --profile string                   The name of the minikube VM being used. This can be set to allow having multiple instances of minikube independently. (default "minikube")
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

Or if you run --help on it, it shows the corba help, not kubectl itself.

Would it make sense to deprecate it? Let users use kubectl, as long as we have the minikube profile to allow setting the context, or switching the context it should be okay.

wdyt? @medyagh @tstromberg @afbjorklund

@afbjorklund
Copy link
Collaborator

afbjorklund commented Jul 4, 2019

I wouldn't say lots of problems, you just have to put the -- in the right place...

$ minikube kubectl -- --help
kubectl controls the Kubernetes cluster manager

See #4333

But maybe we should go for something like sudo minikube kubectl --install ?

I would prefer to install it in e.g. the home directory, but it's not always in $PATH.
So could use something like /usr/local/bin, and hope that is in the default path*.

  • for instance the root user does not have /usr/local/bin in the $PATH on RHEL/CentOS

I just want the user to avoid having to go through two horrible installation procedures.

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube
sudo install minikube /usr/local/bin

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

See #3645

Hopefully some documentation could "fix" this ?

I think that we should handle kubectl like kubelet...

@afbjorklund afbjorklund added triage/discuss Items for discussion cmd/kubectl Issues with the "kubectl" command labels Jul 4, 2019
@josedonizetti
Copy link
Member Author

@afbjorklund Thank you so much for clarifying. That makes a lot of sense, definitely, some documentation would fix it.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Jul 6, 2019

Thanks for the suggestion, in the current form it wouldn't fly very well with our documentation.

$ minikube kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080
Error: unknown flag: --image
Usage:
  minikube kubectl [flags]

Then again, maybe it needs some improvements anyway.

$ minikube kubectl -- run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/hello-minikube created

But we should write minikube kubectl -- everywhere.

Or add that --install command to put it in the $PATH.

@logoff
Copy link

logoff commented Jan 23, 2020

I was experiencing same issue with --image flag and as I was aliasing kubectl command to avoid writing minikube all the time, I decided changing alias to this:

alias kubectl="minikube kubectl --"

Hope this helps to more users 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/kubectl Issues with the "kubectl" command
Projects
None yet
Development

No branches or pull requests

4 participants