k3s server --data-dir not working correctly

Created on 31 Dec 2019  路  4Comments  路  Source: k3s-io/k3s

Version:
v1.0.0

Describe the bug
move from k3s server from a VM to another copying /var/lib/rancher/k3s to /data/k3s
then deploy k3s using --data-dir /data/k3s but k3s crash on start because is trying to find files in /var/lib/rancher/k3s

Dec 31 13:19:23 neries-master k3s[14705]: time="2019-12-31T13:19:23.226094778Z" level=fatal msg="starting kubernetes: invalid configuration: [unable to read client-cert /var/lib/rancher/k3s/server/tls/client-admin.crt for user due to open /var/lib/rancher/k3s/server/tls/client-admin.crt: no such file or directory, unable to read client-key /var/lib/rancher/k3s/server/tls/client-admin.key for user due to open /var/lib/rancher/k3s/server/tls/client-admin.key: no such file or directory, unable to read certificate-authority /var/lib/rancher/k3s/server/tls/server-ca.crt for local due to open /var/lib/rancher/k3s/server/tls/server-ca.crt: no such file or directory]"

Most helpful comment

then --data-dir it's not working correctly, should be fixed

All 4 comments

@segator you will probably want to setup a symlink from /var/lib/rancher/k3s to /data/k3s because there are a number of kubeconfigs and other persistent state files that save absolute paths prefixed with the data directory.

then --data-dir it's not working correctly, should be fixed

Same issue in k3s agent

Same issue in k3s agent

my fault.

$ curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=latest K3S_URL=https://xxxx:6443 K3S_TOKEN=TOKEN INSTALL_K3S_CHANNEL=latest sh -s - agent --data-dir=/opt/docker/rancher/k3s/
$ sudo systemctl restart k3s-agent.service

solved my issue

Was this page helpful?
0 / 5 - 0 ratings