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

service: --format flag missing? #5699

Closed
jroper opened this issue Oct 23, 2019 · 3 comments
Closed

service: --format flag missing? #5699

jroper opened this issue Oct 23, 2019 · 3 comments
Labels
co/service issues related to the service feature kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@jroper
Copy link

jroper commented Oct 23, 2019

It used to be possible to do this:

export MY_SERVICE_HOST=$(minikube service my-service --format "{{.IP}}:{{.Port}}")

And then you'd have the host name and port, without a prefixed scheme, and this is useful because not everything is http or https. Since the --format option was removed, this is no longer possible.

In the meantime, this seems to be the most expedient way for a script to get a hostname:port string:

export MY_SERVICE_HOST=$(minikube ip):$(kubectl get service my-service -o "jsonpath={.spec.ports[0].nodePort}")
@tstromberg
Copy link
Contributor

As far as I know, minikube --format wasn't removed, though I will note that it no longer appears minikube help. It's definitely there though:

serviceCmd.PersistentFlags().StringVar(&serviceURLFormat, "format", defaultServiceFormatTemplate, "Format to output service URL in. This format will be applied to each url individually and they will be printed one at a time.")

Were you getting an error message trying to use that command?

Possibly related: #5117

@tstromberg tstromberg added the co/service issues related to the service feature label Oct 23, 2019
@tstromberg tstromberg changed the title Allow minikube service to return something useful for services that aren't http or https service: --format flag missing? Oct 23, 2019
@tstromberg tstromberg added triage/needs-information Indicates an issue needs more information in order to work on it. kind/bug Categorizes issue or PR as related to a bug. labels Oct 23, 2019
@sharifelgamal
Copy link
Collaborator

This seems to be an issue with documentation, rather than functionality. Have you tried using the --format flag and getting an error?

@priyawadhwa
Copy link

Hey @jroper I just tried running

kubectl run busybox --image busybox -- sleep 1000
kubectl expose deploy/busybox --port 8080 --type NodePort
minikube service busybox --format "{{.IP}}:{{.Port}}"

and got the expected output

|-----------|---------|-------------|---------------------|
| NAMESPACE |  NAME   | TARGET PORT |         URL         |
|-----------|---------|-------------|---------------------|
| default   | busybox |             | 192.168.39.40:31302 |
|-----------|---------|-------------|---------------------|
192.168.39.40:31302

from Minikube build @ HEAD.

I'm going to close this issue as it seems the --format flag is working as expected. The main issue is that it doesn't appear in help text, but I think that should be covered by #5117. If you think this has been closed in error, please reopen at any time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/service issues related to the service feature kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants