kubesphere / kubesphere/website

failed: Failed to exec command: sudo -E /bin/bash -c "systemctl daemon-reload && systemctl enable --now k3s"

Open
#2,895 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
SCSS
Stars
97
Forks
418
PR merge metrics
No merged PRs in 30d

Description

我的主机已全部关闭防火墙,部署 K3s 和 KubeSphere出现以下报错
执行./kk create cluster -f config-sample.yaml 命令报错
`16:38:44 CST [K3sInitClusterModule] Generate k3s registry config
16:38:44 CST skipped: [master]
16:38:44 CST [K3sInitClusterModule] Enable k3s service
16:38:46 CST message: [master]
enable k3s failed: Failed to exec command: sudo -E /bin/bash -c "systemctl daemon-reload && systemctl enable --now k3s"
Created symlink from /etc/systemd/system/multi-user.target.wants/k3s.service to /etc/systemd/system/k3s.service.
Job for k3s.service failed because the control process exited with error code. See "systemctl status k3s.service" and "journalctl -xe" for details.: Process exited with status 1
16:38:46 CST retry: [master]
16:38:53 CST message: [master]
enable k3s failed: Failed to exec command: sudo -E /bin/bash -c "systemctl daemon-reload && systemctl enable --now k3s"
Job for k3s.service failed because the control process exited with error code. See "systemctl status k3s.service" and "journalctl -xe" for details.: Process exited with status 1
16:38:53 CST retry: [master]
16:38:59 CST message: [master]
enable k3s failed: Failed to exec command: sudo -E /bin/bash -c "systemctl daemon-reload && systemctl enable --now k3s"
Job for k3s.service failed because the control process exited with error code. See "systemctl status k3s.service" and "journalctl -xe" for details.: Process exited with status 1
16:38:59 CST failed: [master]
error: Pipeline[K3sCreateClusterPipeline] execute failed: Module[K3sInitClusterModule] exec failed:
failed: [master] [EnableK3sService] exec failed after 3 retires: enable k3s failed: Failed to exec command: sudo -E /bin/bash -c "systemctl daemon-reload && systemctl enable --now k3s
Job for k3s.service failed because the control process exited with error code. See "systemctl status k3s.service" and "journalctl -xe" for details.: Process exited with status 1
[root@master ~]# kubectl auth can-i get nodes --as root
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?
`
查看服务里面报错 journalctl -xe
`5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.202542094+08:00" level=info msg="To join node to cluster: k3s agent -s https://192.168.20.33:6443 -t ${NODE_TOKEN}"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.203232896+08:00" level=info msg="Wrote kubeconfig /etc/rancher/k3s/k3s.yaml"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.203250871+08:00" level=info msg="Run: k3s kubectl"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.203539871+08:00" level=info msg="Waiting for API server to become available"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.220683523+08:00" level=info msg="Cluster-Http-Server 2023/05/17 17:27:30 http: TLS handshake error from 127.0.0.1:47686: r
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.223514625+08:00" level=info msg="Cluster-Http-Server 2023/05/17 17:27:30 http: TLS handshake error from 127.0.0.1:47694: r
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.230464071+08:00" level=info msg="certificate CN=master signed by CN=k3s-server-ca@1684312725: notBefore=2023-05-17 08:38:4
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.233261417+08:00" level=info msg="certificate CN=system:node:master,O=system:nodes signed by CN=k3s-client-ca@1684312725: n
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.238188311+08:00" level=info msg="Module overlay was already loaded"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.238207540+08:00" level=info msg="Module nf_conntrack was already loaded"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.238214466+08:00" level=info msg="Module br_netfilter was already loaded"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.238220452+08:00" level=info msg="Module iptable_nat was already loaded"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.253133986+08:00" level=info msg="Connecting to proxy" url="wss://127.0.0.1:6443/v1-k3s/connect"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.255185386+08:00" level=info msg="Handling backend connection request [master]"
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.257196240+08:00" level=info msg="Running kubelet --address=0.0.0.0 --anonymous-auth=false --authentication-token-webhook=t
5月 17 17:27:30 master k3s[24688]: time="2023-05-17T17:27:30.258561959+08:00" level=info msg="Running kube-proxy --cluster-cidr=10.233.64.0/18 --conntrack-max-per-core=0 --conntrack-t
5月 17 17:27:30 master k3s[24688]: Flag --cni-bin-dir has been deprecated, will be removed along with dockershim.
5月 17 17:27:30 master k3s[24688]: Flag --cni-conf-dir has been deprecated, will be removed along with dockershim.
5月 17 17:27:30 master k3s[24688]: Flag --network-plugin has been deprecated, will be removed along with dockershim.
5月 17 17:27:30 master k3s[24688]: W0517 17:27:30.266552 24688 server.go:220] WARNING: all flags other than --config, --write-config-to, and --cleanup are deprecated. Please begin u
5月 17 17:27:30 master systemd[1]: Started Kubernetes systemd probe.
-- Subject: Unit run-24701.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit run-24701.scope has finished starting up.
--
-- The start-up result is done.
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.280203 24688 server.go:436] "Kubelet version" kubeletVersion="v1.21.4+k3s1"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.301279 24688 dynamic_cafile_content.go:167] Starting client-ca-bundle::/var/lib/rancher/k3s/agent/client-ca.crt
5月 17 17:27:30 master k3s[24688]: E0517 17:27:30.302880 24688 node.go:161] Failed to retrieve node info: nodes "master" is forbidden: User "system:kube-proxy" cannot get resource "
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.399541 24688 server.go:660] "--cgroups-per-qos enabled, but --cgroup-root was not specified. defaulting to /"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.399783 24688 container_manager_linux.go:291] "Container manager verified user specified cgroup-root exists" cgroupRoot=[]
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.399852 24688 container_manager_linux.go:296] "Creating Container Manager object based on Node Config" nodeConfig={RuntimeCgroupsNam
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.399871 24688 topology_manager.go:120] "Creating topology manager with policy per scope" topologyPolicyName="none" topologyScopeName
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.399887 24688 container_manager_linux.go:327] "Initializing Topology Manager" policy="none" scope="container"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.399892 24688 container_manager_linux.go:332] "Creating device plugin manager" devicePluginEnabled=true
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.400033 24688 kubelet.go:307] "Using dockershim is deprecated, please consider using a full-fledged CRI implementation"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.400058 24688 client.go:78] "Connecting to docker on the dockerEndpoint" endpoint="unix:///var/run/docker.sock"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.400071 24688 client.go:97] "Start docker client with request timeout" timeout="2m0s"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.414053 24688 docker_service.go:566] "Hairpin mode is set but kubenet is not enabled, falling back to HairpinVeth" hairpinMode=promi
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.414091 24688 docker_service.go:242] "Hairpin mode is set" hairpinMode=hairpin-veth
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.414226 24688 cni.go:239] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.421424 24688 cni.go:239] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.421511 24688 docker_service.go:257] "Docker cri networking managed by the network plugin" networkPluginName="cni"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.421707 24688 cni.go:239] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
5月 17 17:27:30 master k3s[24688]: I0517 17:27:30.448998 24688 docker_service.go:264] "Docker Info" dockerInfo=&{ID:6c2eeb45-9679-4b09-af4b-050f0388c2bc Containers:0 ContainersRunni
5月 17 17:27:30 master k3s[24688]: E0517 17:27:30.449034 24688 server.go:288] "Failed to run kubelet" err="failed to run Kubelet: misconfiguration: kubelet cgroup driver: \"cgroupfs
5月 17 17:27:30 master systemd[1]: k3s.service: main process exited, code=exited, status=1/FAILURE
5月 17 17:27:30 master systemd[1]: Failed to start Lightweight Kubernetes.
-- Subject: Unit k3s.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit k3s.service has failed.
--
-- The result is failed.
5月 17 17:27:30 master systemd[1]: Unit k3s.service entered failed state.
5月 17 17:27:30 master systemd[1]: k3s.service failed.
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported `./kk create cluster -f config-sample.yaml` command, then inspect the `k3s.service` output using `systemctl status` and `journalctl -xe`. The logs identify kubelet startup and Docker networking failures, but no repository file or test is named. Done would require isolating the cause and documenting a confirmed resolution or a reproducible project change.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, linux
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.