autok3s icon indicating copy to clipboard operation
autok3s copied to clipboard

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

Open jinjianming opened this issue 1 year ago • 1 comments

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

jinjianming avatar Oct 19 '23 04:10 jinjianming

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

JacieChao avatar Oct 19 '23 08:10 JacieChao

any news?

goolzerg avatar Jul 03 '24 14:07 goolzerg

@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 avatar Jul 15 '24 08:07 JacieChao

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 avatar Jul 17 '24 03:07 JacieChao

Tested with v0.9.3-rc1

JacieChao avatar Jul 17 '24 07:07 JacieChao