smbambling / local_k3s_cluster

Local K3s cluster using Lima or Multipass
1 stars 2 forks source link

Error in vmnet setup #2

Open wackazong opened 9 months ago

wackazong commented 9 months ago

Hey there, I think you built exactly what I need. Trying it out right now. I encountered one problem: the replacement sed command has trouble with my networks.yaml file. Still, the content of my networks.yaml seems fine.

❯ socket_vmnet_path=$(readlink -f $(brew --prefix)/opt/socket_vmnet/bin/socket_vmnet | \
sed 's_/_\\/_g') && sed -i -re "s/^(  socketVMNet:).*/\1 \"$socket_vmnet_path\"/"  ${HOME}/.lima/_config/networks.yaml

sed: 1: "s/^(  socketVMNet:).*/\ ...": \1 not defined in the RE
$ cat ~/.lima/_config/networks.yaml 
# Path to socket_vmnet executable. Because socket_vmnet is invoked via sudo it should be
# installed where only root can modify/replace it. This means also none of the
# parent directories should be writable by the user.
#
# The varRun directory also must not be writable by the user because it will
# include the socket_vmnet pid file. Those will be terminated via sudo, so replacing
# the pid file would allow killing of arbitrary privileged processes. varRun
# however MUST be writable by the daemon user.
#
# None of the paths segments may be symlinks, why it has to be /private/var
# instead of /var etc.
paths:
# socketVMNet requires Lima >= 0.12 .
# socketVMNet has precedence over vdeVMNet.
  socketVMNet: "/opt/homebrew/Cellar/socket_vmnet/1.1.3/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
    gateway: 192.168.104.1
    netmask: 255.255.255.0
    # 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: en0
    # 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
smbambling commented 9 months ago

Hmmm....this might be an issue with the version of SED that is being called. My guess is you're using the MacOS default SED vs GNU SED. If you have brew I recommend installed GNU SED, but I'll see if I can make it work with both for the future.

wackazong commented 9 months ago

Ok, thanks!