cnrancher / autok3s

Run K3s Everywhere
https://www.suse.com
Apache License 2.0
741 stars 76 forks source link

[BUG] Invalid setting etcd-snapshot-schedule-cron #639

Closed jinjianming closed 1 month ago

jinjianming commented 10 months ago

This is my complete boot command, and you can see that I have set 'etcd-snapshot-schedule-cron' to execute backup logic every minute

k3s master command: INSTALL_K3S_EXEC='server --advertise-address=192.168.0.248 --cluster-cidr=10.42.0.0/16 --cluster-init --node-external-ip=192.168.0.248 --tls-san=192.168.0.248 --disable traefik,metrics-server --data-dir /work/lib/rancher/k3s --etcd-snapshot-schedule-cron * * * * * --etcd-snapshot-retention 15 --service-node-port-range 1-65535 --kubelet-arg container-log-max-files=3 --kubelet-arg container-log-max-size=50Mi --kubelet-arg root-dir=/work/lib/rancher/k3s/kubelet --default-local-storage-path /work/lib/rancher/k3s/local-storage ' INSTALL_K3S_SKIP_DOWNLOAD='true' K3S_TOKEN='23bb4389eee724dbd5615e2331e81733' install.sh"

But it did not take effect. After analysis, it was found that Autok3s will configure line breaks

ExecStart=/usr/local/bin/k3s \
    server \
        ...... \
        '--etcd-snapshot-schedule-cron' \
        '*' \
        '*' \
        '*' \
        '*' \
        '*' \

I tried to manually modify it to the following format and it works properly

ExecStart=/usr/local/bin/k3s \
    server \
        ...... \
        '--etcd-snapshot-schedule-cron' \
        '* * * * *'

CC @JacieChao @orangedeng

JacieChao commented 10 months ago

Passing a quoted string inside another quoted string is hard to get right. Maybe we need to refactor the installation parameters by K3s configuration file for advanced installation rather than the only setting with INSTALL_K3S_EXEC env. Should consider with https://github.com/cnrancher/autok3s/issues/638

goolzerg commented 1 month ago

any news?

JacieChao commented 1 month ago

@goolzerg This feature is already working in progress and doing the final test. We will release v0.9.3 as soon as this feature is tested. Thanks for your patience.

JacieChao commented 1 month ago

The K3s server/agent configuration can be set from the Server Config File/Agent Config File which is hidden by default from UI.

For users who use the CLI, use the parameter --server-config-file /my/server-config.yaml --agent-config-file /my/agent-config.yaml

JacieChao commented 1 month ago

Tested with v0.9.3-rc1