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

none: bind to the localhost interface by default #4313

Open
tstromberg opened this issue May 22, 2019 · 17 comments
Open

none: bind to the localhost interface by default #4313

tstromberg opened this issue May 22, 2019 · 17 comments
Labels
co/none-driver help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/security security issues lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@tstromberg
Copy link
Contributor

For improved security by default.

@tstromberg tstromberg changed the title "none" driver should bind to the localhost interface by default none: bind to the localhost interface by default May 22, 2019
@tstromberg tstromberg added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels May 22, 2019
@tstromberg
Copy link
Contributor Author

Related: #2762

@tstromberg tstromberg added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label May 22, 2019
@vnzongzna
Copy link

vnzongzna commented May 22, 2019

Can I work on this issue? This would be my first contribution in k8s, might need some guidance

@tstromberg
Copy link
Contributor Author

@vaibhavk - Yes, I would love help on this. Much of this goes toward rectifying https://github.com/kubernetes/minikube/blob/master/docs/vmdriver-none.md#decreased-security - but in the future with Docker/Podman deployments, it will also be necessary.

What I propose is that when run with the none driver, the services listed in that document should all bind to 127.0.0.1 by default. We'll also use this in the future when we support docker/podman deployments. Some further implementation details:

One approach for kubelet might be to have code that adds ExtraOptions if the driver is none. See

func NewKubeletConfig(k8s config.KubernetesConfig, r cruntime.Manager) (string, error) {

Let me know if you would like more guidance. Feel free to reach out on Slack #minikube as well if you prefer real-time discussion. Thank you!

@tstromberg tstromberg added the r/2019q2 Issue was last reviewed 2019q2 label May 24, 2019
@medyagh
Copy link
Member

medyagh commented Jul 2, 2019

@vaibhavk are you still working on this ?

@vnzongzna
Copy link

@medyagh Yes, I'm back on it

@afbjorklund
Copy link
Collaborator

If we bind everything to localhost on the VM, how will you access it from the developer machine ?

@afbjorklund
Copy link
Collaborator

This feature would be another reason why generic (#4733) is needed. The current workaround of running --vm-driver=none on a remote VM would no longer work properly after this, if it only listens on localhost. It would require you to ssh into the control plane from your developer machine, in order to reach the apiserver. It's probably a good feature for none, though. It was never supposed to expose it outside of localhost.

@itsallonetome
Copy link

itsallonetome commented Jul 17, 2019

I've been struggling with this ... an alternative (which would work for me) is an option to specify whether minikube should take its external interface to be the host's IP address (as at present) or localhost or the docker bip gateway.

At present, I can find no way to force minikube to use localhost. using --extra-config kubelet.node-ip="127.0.0.1" breaks multi-pod systems as the pods listen on 127.0.0.1 but other pods try to talk to them on the hosts's external IP address.

I get:

$ kubectl cluster-info
Kubernetes master is running at https://localhost:8443

$ minikube ip
10.74.54.212

$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:98:08:a7 brd ff:ff:ff:ff:ff:ff
    inet 10.74.54.212/23 brd 10.74.55.255 scope global ens192
       valid_lft forever preferred_lft forever
    inet6 fe80::250:56ff:fe98:8a7/64 scope link
       valid_lft forever preferred_lft forever
7: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:5a:ca:32:1d brd ff:ff:ff:ff:ff:ff
    inet 172.18.1.1/24 brd 172.18.1.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:5aff:feca:321d/64 scope link
       valid_lft forever preferred_lft forever

I can't use the other drivers as the VMs in which I'm working have virtualisation disabled.

@vnzongzna
Copy link

/assign

@tstromberg tstromberg removed the r/2019q2 Issue was last reviewed 2019q2 label Sep 20, 2019
@avisiedo
Copy link

avisiedo commented Dec 1, 2019

Hi.... I have a situation where I would like just the opposite. I mean, I am starting the cluster with minikube, and I would like the sockets to be bound to 0.0.0.0 so that I can access from another host. I now that minikube is not for production, and it is not my intention to use this for production, but make this bind to external IP is good for me. I am using --vm-driver=none to start the kubernetes cluster.

So in short: I could I start minikube to allow it to bind to 0.0.0.0?? Any configuration file to set up to allow this?? I am just starting with Kubernetes, sorry if I don't have enough skills yet.

Thanks!

@ykfq
Copy link

ykfq commented Jan 15, 2020

Still need this feature when there are mutilple nics.

@medyagh
Copy link
Member

medyagh commented Mar 8, 2020

@vaibhavk are you still interested to do this ?

@vnzongzna
Copy link

@medyagh I recently switched to Darwin & not able to test the build, is there any work around for this? I'll be happy to work on this again and send PR

@vnzongzna vnzongzna removed their assignment Mar 18, 2020
@medyagh
Copy link
Member

medyagh commented Apr 22, 2020

Hi.... I have a situation where I would like just the opposite. I mean, I am starting the cluster with minikube, and I would like the sockets to be bound to 0.0.0.0 so that I can access from another host. I now that minikube is not for production, and it is not my intention to use this for production, but make this bind to external IP is good for me. I am using --vm-driver=none to start the kubernetes cluster.

So in short: I could I start minikube to allow it to bind to 0.0.0.0?? Any configuration file to set up to allow this?? I am just starting with Kubernetes, sorry if I don't have enough skills yet.

Thanks!

@avisiedo opens ups big security problems,since minikbue is directed at develoipers for local kubernetes, that would be a bad default ! however I would accept any PR that would add that as an optional feature. (with extra warnning to the user that if they take the risk we could allow that)

@medyagh
Copy link
Member

medyagh commented Apr 22, 2020

@medyagh I recently switched to Darwin & not able to test the build, is there any work around for this? I'll be happy to work on this again and send PR
@vnzongzna
yes ofcourse you can still work on this. please let me know if you need any help on the PR review

@tstromberg tstromberg removed the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Aug 12, 2020
@BartDrown
Copy link

BartDrown commented Dec 9, 2020

Hi.... I have a situation where I would like just the opposite. I mean, I am starting the cluster with minikube, and I would like the sockets to be bound to 0.0.0.0 so that I can access from another host. I now that minikube is not for production, and it is not my intention to use this for production, but make this bind to external IP is good for me. I am using --vm-driver=none to start the kubernetes cluster.

So in short: I could I start minikube to allow it to bind to 0.0.0.0?? Any configuration file to set up to allow this?? I am just starting with Kubernetes, sorry if I don't have enough skills yet.

Thanks!

Anything new on this?
I'm looking for way to access minikube pod in cluster within local network and I cannot do it in any way except using socat.

I've tried to do this with iptables, but currently communication worked only in one way.

In case that someone would like to use it anyway with socat I post solution below:
socat TCP-LISTEN:<HOST_PORT>,fork TCP:<CLUSTER_ADDRESS>:<POD_PORT> &

@tstromberg tstromberg added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Feb 18, 2021
@tstromberg
Copy link
Contributor Author

@KubaJakubowski - That would be a completely different issue from binding to localhost, and well out of the scope of minikube.

My personal recommendation would be an SSH tunnel, but socat would probably work as well. Alternatively, you should probably just run kubeadm directly if you need network access. It's what minikube runs underneath.

@spowelljr spowelljr added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/backlog Higher priority than priority/awaiting-more-evidence. labels May 26, 2021
@spowelljr spowelljr added priority/backlog Higher priority than priority/awaiting-more-evidence. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Sep 15, 2021
@spowelljr spowelljr added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/none-driver help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/security security issues lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

9 participants