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

Add flag "--listen-address" for docker and podman driver #10653

Merged
merged 11 commits into from
Mar 5, 2021
Merged

Add flag "--listen-address" for docker and podman driver #10653

merged 11 commits into from
Mar 5, 2021

Conversation

Loyen
Copy link
Contributor

@Loyen Loyen commented Feb 28, 2021

Allow a user to set what IP to listen on when binding ports for the docker and podman driver.

Warns the user when used during start.

Example:

$ ./out/minikube-linux-amd64 start --driver=docker --listen-address=0.0.0.0
😄  minikube v1.18.0-beta.0 on Ubuntu 20.04
✨  Using the docker driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🔥  Creating docker container (CPUs=2, Memory=6300MB) ...
💡  minikube is not meant for production use. You are opening non-local traffic
❗  Listening to 0.0.0.0. This is not recommended and can cause a security vulnerability. Use at your own risk
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.3 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v4
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Fixes #8008

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 28, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @Loyen. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

Welcome @Loyen!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 28, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 28, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @Loyen for this PR as part of this PR please do the following
1- Add warn to user that if they set this flag,
that minikube is NOT meant to be used for production use and this is not recommended and user should assume all the security risks associated with it

2- Validate the listen flag to be a valid listen address. (so if they pass something not parsable we should exit

valdiateListenFlag(...) {
if not ....
exit.WithUsage
}

2-

cmd/minikube/cmd/start_flags.go Outdated Show resolved Hide resolved
Loyen added 2 commits March 1, 2021 21:08
Confusing to keep it under "docker & podman" when it's only for docker.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 1, 2021
@Loyen
Copy link
Contributor Author

Loyen commented Mar 1, 2021

Cheers for the feedback @medyagh!

1- Add warn to user that if they set this flag,
that minikube is NOT meant to be used for production use and this is not recommended and user should assume all the security risks associated with it

There's currently a short warning message when you use --listen-address looking like:

Listening to {{.listenAddr}}. Please be advised

I can amend it to have a more informational message.

2- Validate the listen flag to be a valid listen address. (so if they pass something not parsable we should exit

I've now added validation.

@Loyen Loyen requested a review from medyagh March 1, 2021 22:19
cmd/minikube/cmd/start_flags.go Outdated Show resolved Hide resolved
pkg/drivers/kic/kic.go Show resolved Hide resolved
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Loyen do u mind pasting the output of minikube start after this PR in the description of the PR ?

To add more context to the warning message for --listen-address
@Loyen
Copy link
Contributor Author

Loyen commented Mar 2, 2021

@medyagh Added the output of start to the description (which includes the "do not use in production" text).

@Loyen Loyen changed the title Add flag "--listen-address" for docker driver Add flag "--listen-address" for docker and podman driver Mar 2, 2021
@Loyen Loyen requested a review from medyagh March 2, 2021 20:29
To stay consistent with other messages. Also moved it above the warning
message regarding what IP is set as listen-address to make more sense in
the message flow.
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @Loyen just one small thing left

pkg/drivers/kic/kic.go Outdated Show resolved Hide resolved
@Loyen Loyen requested a review from medyagh March 5, 2021 14:52
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Loyen, medyagh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 5, 2021
@medyagh
Copy link
Member

medyagh commented Mar 5, 2021

thank you @Loyen

@medyagh medyagh merged commit d2cb052 into kubernetes:master Mar 5, 2021
@Loyen Loyen deleted the add-listen-address-flag branch March 6, 2021 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow minikube be accessible from outside network (add --listen-address flag)
4 participants