-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Enabling a shared
or bridged
network causes lima kubectl cluster-info
to fail
#375
Comments
Why not simply use |
I do not have anything else in the override file. As a matter of fact, I completely removed my This had been working fine in the past, so I was surprised that it stopped working and caused |
If all you need is a reachable IP address, I would recommend you do that with Colima directly.
It is easier than you think. Simply start with |
I am a bit confused with the solution that you are recommending, only because this ticket is about the fact the
I am not trying to run |
Yeah, colima runs the command as part of the startup for kubernetes to ensure that the startup is successful. What I suspect is that k3s bootstraps using the vmnet IP address and thereby unreachable without using the IP. |
Yes. It works when the network override is commented out. That additional info is helpful. Thanks. Adding
|
This is the closest issue I can find related to what I'm trying to achieve setting up a bridged network mode. I have yet to see how to configure colima to start up the VM using my own network dhcp so I can get a real IP off my network. When I do try to add the network override.yaml for lima, I can start colima fine, but my network override in lima does not setup a bridge the way I'd expect it to. My override is simple:
Is this even possible? I've googled this many times and have found little information on this topic. Any help is much appreciated. |
This should work, as long as your host network interface is
Then check your
Make sure your host interface name matches the one in the |
Hi @jandubois thanks for you quick response. I am using
Here's what my
This is how I'm trying to start colima:
Here's something I observed from
That is the network IP my colima instance keeps getting instead of my own home network IP that
If I attempt to change |
I'm sorry @ipv1337, I don't know how colima manages the networking setup; I was just responding why the bridged network might not get an IP address if you bridge through the wrong host adapter, but that doesn't seem to be a problem for you. Maybe @abiosoft can chime in with the correct commandline options needed to use the bridged networking. One (unrelated) thing I find curious that you are using |
We can ignore the |
Yeah, true. It is not expected a user would modify the file directly. Maybe an introduction of
It is a misinformation from Colima's end, it is already corrected in |
Easy bridged networking would be an awesome feature. I have a usecase where I need to run x86 containers in k8s on an m1 mac and have services be exposed to another host on my network. I was able to get bridged networking working with this config system_profiler SPNetworkDataType -json | jq -r 'first(.SPNetworkDataType[] | select(.ip_address) | .interface)'
en7
...
network:
address: true
networks:
- lima: bridged
interface: en7
- vzNAT: false
interface: col0
paths:
# socketVMNet requires Lima >= 0.12 .
# socketVMNet has precedence over vdeVMNet.
socketVMNet: "/opt/homebrew/Cellar/socket_vmnet/1.1.2/bin/socket_vmnet"
# vdeSwitch and vdeVMNet are DEPRECATED.
vdeSwitch: /opt/vde/bin/vde_switch
vdeVMNet: /opt/vde/bin/vde_vmnet
varRun: /private/var/run/lima
sudoers: /private/etc/sudoers.d/lima
group: everyone
networks:
user-v2:
mode: user-v2
# user-v2 network is experimental network mode which supports all functionalities of default usernet network and also allows vm -> vm communication.
# Doesn't support configuration of custom gateway; hardcoded to 192.168.5.0/24
shared:
mode: shared
gateway: 192.168.105.1
dhcpEnd: 192.168.105.254
netmask: 255.255.255.0
bridged:
mode: bridged
interface: en7
# bridged mode doesn't have a gateway; dhcp is managed by outside network
host:
mode: host
gateway: 192.168.106.1
dhcpEnd: 192.168.106.254
netmask: 255.255.255.0
|
I can't get this to work. The Lima override in ~/.lima/_config/override.yaml is not picked up by Colima, as Colima seems to use a separate $LIMA_HOME in ~/.colima/_lima/. Modifying ~/.colima/_lima/_config/override.yaml does "work", in that the change is picked up, but since ~/.colima/_lima/_config/networks.yaml only contains a user-v2 network (https://github.com/abiosoft/colima/blob/9b0809d0ed9ad3ff1e57c405f27324e6298ca04f/embedded/network/networks.yaml) it fails with:
And the networks.yaml can't be edited, as it's overwritten each time Colima starts. So how is this supposed to work? |
Yep I got exactly the same error when I was trying to start a colima VM with bridged network. Found this issue when I was googling for more information. It looks like the code is always preparing the vmnet in "shared" mode rather than "bridged". Finally, after some investigation, I got what I wanted with a local build after patching the code like this: diff --git a/daemon/process/vmnet/vmnet.go b/daemon/process/vmnet/vmnet.go
index 12d4030..e66703d 100644
--- a/daemon/process/vmnet/vmnet.go
+++ b/daemon/process/vmnet/vmnet.go
@@ -75,10 +75,11 @@ func (*vmnetProcess) Start(ctx context.Context) error {
go func() {
// rootfully start the vmnet daemon
command := cli.CommandInteractive("sudo", BinaryPath,
- "--vmnet-mode", "shared",
- "--socket-group", "staff",
- "--vmnet-gateway", NetGateway,
- "--vmnet-dhcp-end", NetDHCPEnd,
+ "--vmnet-mode", "bridged",
+ "--vmnet-interface", "en0",
+// "--socket-group", "staff",
+// "--vmnet-gateway", NetGateway,
+// "--vmnet-dhcp-end", NetDHCPEnd,
"--pidfile", pid,
socket,
)
diff --git a/embedded/network/networks.yaml b/embedded/network/networks.yaml
index abd37f1..20f1241 100644
--- a/embedded/network/networks.yaml
+++ b/embedded/network/networks.yaml
@@ -2,7 +2,6 @@
# This file would be replaced by Colima on startup.
networks:
- user-v2:
- mode: user-v2
- gateway: 192.168.5.2
- netmask: 255.255.255.0
+ bridged:
+ mode: bridged
+ interface: en0
diff --git a/embedded/network/sudo.txt b/embedded/network/sudo.txt
index 3fbd4ab..f8091fc 100644
--- a/embedded/network/sudo.txt
+++ b/embedded/network/sudo.txt
@@ -1,5 +1,5 @@
# starting vmnet daemon
-%staff ALL=(root:wheel) NOPASSWD:NOSETENV: /opt/colima/bin/socket_vmnet --vmnet-mode shared --socket-group staff --vmnet-gateway 192.168.106.1 --vmnet-dhcp-end 192.168.106.254 *
+%staff ALL=(root:wheel) NOPASSWD:NOSETENV: /opt/colima/bin/socket_vmnet --vmnet-mode bridged *
# terminating vmnet daemon
%staff ALL=(root:wheel) NOPASSWD:NOSETENV: /usr/bin/pkill -F /opt/colima/run/*.pid
# validating vmnet daemon The patch is definitely hacky thus far from a mature PR. However, I suppose it's a good start for proof-of-concept and further discussions regarding this feature that some people are looking for 😄 @abiosoft |
Description
colima
is unable to verify that the Kubernetes has started correctly when ashared
orbridged
network is used for the underlying VM.Version
Colima Version: 0.4.4
Lima Version: 0.11.2
Qemu Version: 7.0.0
Operating System
Reproduction Steps
This used to work, but started failing at some point.
I have set up networking for
lima
as discussed here:https://github.com/lima-vm/lima/blob/master/docs/network.md
And then in this file:
.lima/_config/override.yaml
I have this:When I try to start
colima
with the network uncommented then I get:Expected behaviour
I would expect the VM to come up with no errors and everything in a useable state.
Additional context
I am able to reproduce this even after recompiling and installing
vde-2
andvde_vmnet
.The text was updated successfully, but these errors were encountered: