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

minikube kubectl --arguments and stdin for apply -f - not possible #4333

Closed
Doqnach opened this issue May 23, 2019 · 6 comments · Fixed by #4354
Closed

minikube kubectl --arguments and stdin for apply -f - not possible #4333

Doqnach opened this issue May 23, 2019 · 6 comments · Fixed by #4354
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2

Comments

@Doqnach
Copy link

Doqnach commented May 23, 2019

The exact command to reproduce the issue:

  1. $ minikube kubectl version --short
  2. $ echo "foo:" | minikube kubectl apply -f -
  3. $ echo "foo:" | minikube kubectl -- apply -f -
  4. $ echo "foo:" | minikube kubectl apply -- -f -
  5. $ minikube -- kubectl version --short

The full output of the command that failed:

  1. Error: unknown flag: --short
  2. Error: unknown shorthand flag: 'f' in -f
  3. error: no objects passed to apply
  4. error: no objects passed to apply
  5. minikube version: v1.1.0

The expected output of the command that failed:

  1. Just like minikube kubectl -- version --short:
    Client Version: v1.11.8
    Server Version: v1.11.8 
    
  2. Just like echo "foo:" | kubectl apply -f -:
    error: error validating "STDIN": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
  3. Just like echo "foo:" | kubectl apply -f -:
    error: error validating "STDIN": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
  4. Just like echo "foo:" | kubectl apply -f -:
    error: error validating "STDIN": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
  5. Just like minikube kubectl -- version --short:
    Client Version: v1.11.8
    Server Version: v1.11.8 
    

The output of the minikube logs command:

The operating system version:

  • MacOS
  • vmdriver=hyperkit
  • kubectl version v1.11.8 on v1.11.8 k8s cluster, installed via minikube kubectl
@afbjorklund
Copy link
Collaborator

afbjorklund commented May 23, 2019

You will need to use a single -- to terminate the minikube arguments, before you can start to add the ones for the kubectl

minikube -- kubectl --version


EDIT: Managed to get this wrong, it should have been:

minikube kubectl -- --version

Then again --version is not a valid kubectl command, but: minikube kubectl -- version --client

$ minikube -- kubectl version --client
minikube version: v1.1.0
$ minikube kubectl -- version --client
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

@hpandeycodeit
Copy link

minikube -- kubectl --version is not giving me any results. Just the minikube list of commands.

@tstromberg tstromberg added kind/bug Categorizes issue or PR as related to a bug. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. r/2019q2 Issue was last reviewed 2019q2 labels May 23, 2019
@Doqnach
Copy link
Author

Doqnach commented May 23, 2019

$ minikube -- kubectl version --short
minikube version: v1.1.0
$ minikube kubectl -- version --short
Client Version: v1.11.8
Server Version: v1.11.8

The second command is what I expect to get but that notation doesn't work for apply -f -.

@GavinOsborn
Copy link

minikube kubectl version -- --short worked fine in this instance.
But it's not a great experience.

@Doqnach
Copy link
Author

Doqnach commented May 24, 2019

But it does not work for kubectl apply -f - so that doesn't help me much. There should be one notation that works for all of it obviously.

I think, that of my original post, version 3 would be the best option because it gives the most flexibility (e.g.: aliasing minikube --profile some-profile-name kubectl --). That one has the STDIN problem though, which might be a separate bug actually.

@afbjorklund
Copy link
Collaborator

I think, that of my original post, version 3 would be the best option because it gives the most flexibility (e.g.: aliasing minikube --profile some-profile-name kubectl --). That one has the STDIN problem though, which might be a separate bug actually.

Will look into this bug, looks like an oversight:

		c := exec.Command(path, args...)
		c.Stdout = os.Stdout
		c.Stderr = os.Stderr
		if err := c.Run(); err != nil {

i.e. there is no "os.Stdin" passed to the command.

@afbjorklund afbjorklund added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants