Need the procedure for changing Microk8s Flannel from 'vxlan' to 'host-gw'

I am working on an on-premise implementation of Microk8s. By default, Microk8s Flannel is configured to communicate using a vxlan overlay network. This won’t work for our environment and is preventing us from creating a fully-functional cluster. I am trying to change this to ‘host-gw’.

I have been unable to find any documentation or forum entries that explain how to make this change. I have found the file /var/snap/microk8s/current/args/flannel-network-mgr-config. However, this file appears to be an output of the configuration process not the place where the configuration change is actually made.

Any advice would be appreciated.

Fyi. I have not tried this at all.

I think you can use etcdctl. As an example in microk8s ${SNAP}/etcdctl" --endpoint "${etcd_endpoints}" --cert-file "${cert_file}" --key-file "${key_file}" --ca-file "${ca_file}" set "/coreos.com/network/config" "$data"

Where $data is the content of the file /var/snap/microk8s/current/args/flannel-network-mgr-config

Stop flanneld using systemctl run the etcdctl like above. Set the record in etcd then start etcd.

Check this out. https://github.com/ubuntu/microk8s/blob/2db20fdfdbf122185726fb196ac5df9a405143f3/microk8s-resources/wrappers/run-flanneld-with-args#L44

Using etcdctl did not work. I was able to make the change simply be editing the configuration file /var/snap/microk8s/current/args/flannel-network-mgr-config to contain ‘{“Network”: “10.1.0.0/16”, “Backend”: {“Type”: “host-gw”}}’. I had to do this on all nodes of the cluster.

1 Like