garutilorenzo / k3s-oci-cluster

Deploy a Kubernetes cluster for free, using k3s and Oracle always free resources
https://garutilorenzo.github.io/deploy-kubernetes-for-free-oracle-cloud
GNU General Public License v3.0
225 stars 79 forks source link

Can the script be re-run after doing some changes? #42

Closed liviux closed 1 year ago

liviux commented 1 year ago

Hello, thank you for this excellent repo. I want to connect to this cluster some Raspberry Pi 4 that I have. After having some problems, I found that it could be easier if I install Netmaker which runs Wiregurad. This is ok, I have a new VPN like network between all the OCI machines, all RPi, a VPS, my local machine, etc on 10.20.30.0/24. The thing is that now I want to re-run the k3s installation script, on server and on 3 worker nodes but this time with --flannel-iface=nm-netmaker, nm-netmaker being my Wireguard interface. So is it possible to re-run the installation with --flannel-iface= parameter or can some flags be changed/added while the cluster is running?

I tried adding a new /etc/systemd/system/k3s.service.d/network.conf with

[Service]
ExecStart=
ExecStart=/usr/local/bin/k3s agent --node-ip 10.222.0.106 --flannel-iface=nm-netmaker

I tried editing /etc/systemd/system/k3s.service and /etc/rancher/k3s/k3s.yaml and it didn't changed to a new flannel interface. Or maybe i did something wrong.

garutilorenzo commented 1 year ago

Hi @liviux,

I don't think this is the right place for this question. Maybe you have more luck directly on k3s repo page or in k3s docs.

My 2 cents: try to get the flannel configuration and edit directly the deployments/daemonset:

1) Dump kube-flannel daemonset to check the configuration with: kubectl get daemonset -n kube-flannel -o yaml 2) Edit kube flannel daemonset with kubectl edit 2) Set the correct interface in the container args

liviux commented 1 year ago

Hi @liviux,

I don't think this is the right place for this question. Maybe you have more luck directly on k3s repo page or in k3s docs.

My 2 cents: try to get the flannel configuration and edit directly the deployments/daemonset:

  1. Dump kube-flannel daemonset to check the configuration with: kubectl get daemonset -n kube-flannel -o yaml
  2. Edit kube flannel daemonset with kubectl edit
  3. Set the correct interface in the container args

I tried on their Slack, but no answer yet. Tried a classic reinstall with curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=nm-netmaker" sh -, and of course it worked (before that I stopped the service and delete sudo rm -rf /var/lib/rancher/k3s/server/db/etcd). Then manual install on all other worker nodes and they are all on the same wireguard network, but I'm sure this is not the right way to do this. Nodes are not on the previous k3s version, and a lot of changes from your repo.

Per documentation to re-start with different flags

just re-run the curl command

But my re-run changed a lot of things.

garutilorenzo commented 1 year ago

Hi @liviux,

I can't understand if you find a solution or not. This sentence is not clear for me:

Nodes are not on the previous k3s version, and a lot of changes from your repo.

What do yoy mean with: Nodes are not on the previous k3s version? And with and a lot of changes from your repo? You have applied an old version of this repo? I think this is not related to your problem. The flannel customization is not part of the automation.

So I would try to modify the flannel configuration with a specific deployment or by editing directly the configuration with kubectl edit

liviux commented 1 year ago

Sorry. This temporary solution, re-run the script with "curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-iface=nm-netmaker" sh -" it works. It installs again k3s, but I'm not sure how much of the old configuration (the good configuration from your repo) is kept. I re-run it again with INSTALL_K3S_CHANNEL=latest to get the latest k8s version.