alexellis / k3sup

bootstrap K3s over SSH in < 60s 🚀
https://github.com/sponsors/alexellis
Other
6.34k stars 376 forks source link

Suggestion: declare the nodes and its options in a single yaml file Would be a good idea? #410

Closed carlospalavecino closed 1 year ago

carlospalavecino commented 1 year ago

Hi, thanks for the hard work. I was wondering if it would be a good idea to implement a yaml file to define all the infrastructure (control plane, etcd, workers and their features) and the current flags in a single place, so with a single command, k3sup could deploy the entire infrastructure. Something like kubekey is doing (but isn't working on k3s). The infrastructure could be versioned and uploaded to a private repo and even we could handle the updates and the changes from a single file on an easy way.

Why do you need this?

I'm just starting to working on kubernetes and found in k3s + k3sup a sweet spot, this app (k3sup) makes the deploy even easier, I think it could be a nice improvement. I'm deploying some nodes right now in my homelab, but I think a feature like this would give you more control over deployment when you have 5 or more nodes.

Expected Behaviour

I think it could be another way to make the install or upgrade simply changing the k3s version

k3sup install -f myCluster.yaml
k3sup upgrade -f myCluster.yaml

It could save a sample config file with a command

k3sup install --save-config -f myCluster.yaml

Current Behaviour

Right now we need to run the k3sup command for each node with the needit flags

k3sup install --ip $IP --user ubuntu
k3sup join --ip $AGENT_IP --server-ip $SERVER_IP --user $USER

Possible Solution

We could deploy all the infrastructure defined in the yaml file in one line and let k3sup deploy each node

k3sup install -f myCluster.yaml

I know this is a k8s manifest, but perhaps an abstraction of this makes more sense.

[...]
spec:
  hosts:
- name: node1
    address: 172.16.0.2
    internalAddress: 172.16.0.2
    user: ubuntu
    password: "Qcloud@123"
  - name: node2
    address: 172.16.0.3
    internalAddress: 172.16.0.3
    user: ubuntu, password: "Qcloud@123"
  roleGroups:
    etcd:
    - node1
    control-plane: 
    - node1
    worker:
    - node1
    - node2
    host: example.com
    address: "0.0.0.0" 
    port: 6443
  k3s:
    version: v1.23.10
    clusterName: cluster.local
    autoRenewCerts: true
    containerManager: docker # docker, containerd, etc
[...]

Do you want to work on this?

I'm not a Go developer, but if someone could help me i think i could try

Subject to design approval, are you willing to work on a Pull Request for this issue or feature request?

alexellis commented 1 year ago

Hi,

Thanks for your suggestion.

This is not in scope and has been discussed before. It is a non-goal for k3sup. It'll always be command-line based, see how this is approached through a simple bash file:

https://www.openfaas.com/blog/production-faas-linode/

Maybe what you're looking for if you want this complex YAML definition is Ansible or Pulumi? Rancher RKE might also do what you're looking for.

Alex