环境信息:
K3s 版本:
k3s version v1.20.15+k3s1 (c7a91e1c)
go version go1.15.15
节点 CPU 架构、操作系统和版本::
Linux acloud.zylab.com 4.19.90-52.22.v2207.ky10.aarch64 #1 SMP Tue Mar 14 11:52:45 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
集群配置:
1 server
问题描述:
使用k3s默认数据库安装k3s后,K3S服务启动失败。
复现步骤:
- 安装 K3s 的命令:
INSTALL_K3S_SKIP_DOWNLOAD=true
INSTALL_K3S_EXEC=“server --disable-etcd”
./install.sh
预期结果:
预期正常启动K3S服务
实际结果:
K3S启动失败
[root@localhost 03_k3s]# systemctl status k3s
● k3s.service - Lightweight Kubernetes
Loaded: loaded (/etc/systemd/system/k3s.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2025-04-03 14:36:14 CST; 532ms ago
Docs: https://k3s.io
Process: 3245 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS)
Process: 3247 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
Process: 3248 ExecStart=/usr/local/bin/k3s server --disable-etcd (code=exited, status=2)
Main PID: 3248 (code=exited, status=2)
附加上下文/日志:
日志
[root@acloud ~]# journalctl -u k3s
-- Logs begin at Thu 2025-04-03 14:26:48 CST, end at Thu 2025-04-03 14:43:17 CST. --
4月 03 14:30:15 acloud.zylab.com systemd[1]: Starting Lightweight Kubernetes...
4月 03 14:30:15 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:15+08:00" level=info msg="Acquiring lock file /var/lib/rancher/k3s/data/.lock"
4月 03 14:30:15 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:15+08:00" level=info msg="Preparing data dir /var/lib/rancher/k3s/data/4eaf4f6ca81884e88d87b96ad1>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.028950531+08:00" level=info msg="Starting k3s v1.20.15+k3s1 (c7a91e1c)"
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.048142213+08:00" level=info msg="Configuring sqlite3 database connection pooling: maxIdleConns>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.048250925+08:00" level=info msg="Configuring database table schema and indexes, this may take >
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.056905077+08:00" level=info msg="Database tables and indexes are up to date"
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.060599453+08:00" level=info msg="Kine listening on unix://kine.sock"
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.074413604+08:00" level=info msg="certificate CN=system:admin,O=system:masters signed by CN=k3s>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.078288223+08:00" level=info msg="certificate CN=system:kube-controller-manager signed by CN=k3>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.081931578+08:00" level=info msg="certificate CN=system:kube-scheduler signed by CN=k3s-client->
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.085564433+08:00" level=info msg="certificate CN=kube-apiserver signed by CN=k3s-client-ca@ZYRO>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.089255640+08:00" level=info msg="certificate CN=system:kube-proxy signed by CN=k3s-client-ca@Z>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.092841624+08:00" level=info msg="certificate CN=system:k3s-controller signed by CN=k3s-client->
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.096749974+08:00" level=info msg="certificate CN=cloud-controller-manager signed by CN=k3s-clie>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.100611433+08:00" level=info msg="certificate CN=kube-apiserver signed by CN=k3s-server-ca@ZYRO>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.104313709+08:00" level=info msg="certificate CN=system:auth-proxy signed by CN=k3s-request-hea>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.105759771+08:00" level=info msg="certificate CN=etcd-server signed by CN=etcd-server-ca@174366>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.106454392+08:00" level=info msg="certificate CN=etcd-client signed by CN=etcd-server-ca@174366>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: time="2025-04-03T14:30:17.107514138+08:00" level=info msg="certificate CN=etcd-peer signed by CN=etcd-peer-ca@1743661817>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: panic: runtime error: invalid memory address or nil pointer dereference
4月 03 14:30:17 acloud.zylab.com k3s[2220]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x14fc530]
4月 03 14:30:17 acloud.zylab.com k3s[2220]: goroutine 1 [running]:
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/clientaccess.Get(0x3dfe5b7, 0x8, 0x0, 0x40009c2a20, 0x18, 0x4000091800, 0x0, 0x4000be65c0)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/clientaccess/token.go:181 +0x20
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/etcd.ClientURLs(0x45d5440, 0x4000be65c0, 0x0, 0x0, 0x0, 0x2, 0x4000b04330, 0x27, 0x400159d7d8>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/etcd/etcd.go:746 +0x54
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/cluster.(*Cluster).Start(0x40014ddb00, 0x45d5440, 0x4000be65c0, 0x0, 0x0, 0x0)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/cluster/cluster.go:45 +0xd0
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/daemons/control.prepare(0x45d5440, 0x4000be65c0, 0x4000a08408, 0x4001536700, 0x4000d4f530, 0x>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/daemons/control/server.go:318 +0x1c34
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/daemons/control.Server(0x45d5440, 0x4000be65c0, 0x4000a08408, 0x401a800, 0x4000b21020)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/daemons/control/server.go:44 +0x118
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/server.StartServer(0x45d5440, 0x4000be65c0, 0x4000a08400, 0x4000be65c0, 0x1)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/server/server.go:59 +0x74
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/cli/server.run(0x40007ab080, 0x696bfc0, 0x400159e978, 0x0, 0x0, 0x400159e978, 0x0, 0x0, 0x0, >
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/cli/server/server.go:316 +0x13fc
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/pkg/cli/server.Run(0x40007ab080, 0x0, 0x0)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/pkg/cli/server/server.go:43 +0x4c
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/vendor/github.com/urfave/cli.HandleAction(0x3686cc0, 0x4016bc8, 0x40007ab080, 0x40007ab080, 0x0)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/vendor/github.com/urfave/cli/app.go:523 +0x118
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/vendor/github.com/urfave/cli.Command.Run(0x3df9334, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e33455, 0x15>
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/vendor/github.com/urfave/cli/command.go:174 +0x41c
4月 03 14:30:17 acloud.zylab.com k3s[2220]: github.com/rancher/k3s/vendor/github.com/urfave/cli.(*App).Run(0x400075e8c0, 0x40003674d0, 0x3, 0x3, 0x0, 0x0)
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/vendor/github.com/urfave/cli/app.go:276 +0x584
4月 03 14:30:17 acloud.zylab.com k3s[2220]: main.main()
4月 03 14:30:17 acloud.zylab.com k3s[2220]: /go/src/github.com/rancher/k3s/cmd/server/main.go:60 +0x84c
4月 03 14:30:17 acloud.zylab.com systemd[1]: k3s.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
4月 03 14:30:17 acloud.zylab.com systemd[1]: k3s.service: Failed with result 'exit-code'.
4月 03 14:30:17 acloud.zylab.com systemd[1]: Failed to start Lightweight Kubernetes.
4月 03 14:30:22 acloud.zylab.com systemd[1]: k3s.service: Service RestartSec=5s expired, scheduling restart.
4月 03 14:30:22 acloud.zylab.com systemd[1]: k3s.service: Scheduled restart job, restart counter is at 1.
4月 03 14:30:22 acloud.zylab.com systemd[1]: Stopped Lightweight Kubernetes.