bruce
2022 年9 月 9 日 11:22
1
在centos8环境执行k3s的部署出错了。该怎样解决呢?
centos版本信息:
Linux g610-centos 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
部署命令:
curl -sLS https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN=‘793deaa8d23f9832fef7e13f4d64e275’ INSTALL_K3S_EXEC=‘server --tls-san 172.29.131.191 --tls-san 172.29.131.193 --tls-san 172.29.131.194 --node-external-ip 172.29.131.193–kubelet-arg --feature-gates=CPUManager=true --kubelet-arg cpu-manager-policy=static --kubelet-arg cpu-manager-policy-options=full-pcpus-only=true --kubelet-arg system-reserved=memory=4Gi --cluster-cidr 10.42.0.0/16 --cluster-init’ INSTALL_K3S_VERSION=‘v1.24.4+k3s1’ sh -
查看日志
sudo journalctl -xeu k3s.service
time=“2022-09-09T19:10:45+08:00” level=fatal msg=“kubelet exited: failed to run Kubelet: [cpumanager] unable to determine reserved CPU resources for static policy”
ksd
2022 年9 月 10 日 16:06
2
Note: The kubelet requires a CPU reservation greater than zero be made using either --kube-reserved
and/or --system-reserved
or --reserved-cpus
when the static policy is enabled. This is because zero CPU reservation would allow the shared pool to become empty.
参考:Control CPU Management Policies on the Node | Kubernetes
我在你的命令的基础上,进行了简单的修改,参考:
root@rancher-4:~# curl -sLS https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_TOKEN='793deaa8d23f9832fef7e13f4d64e275' INSTALL_K3S_EXEC='server --tls-san 172.29.131.191 --tls-san 172.29.131.193 --tls-san 172.29.131.194 --kubelet-arg feature-gates=CPUManager=true --kubelet-arg cpu-manager-policy=static --kubelet-arg kube-reserved=cpu=1 --kubelet-arg cpu-manager-policy-options=full-pcpus-only=true --kubelet-arg system-reserved=memory=4Gi --cluster-cidr 10.42.0.0/16 --cluster-init' INSTALL_K3S_VERSION='v1.24.4+k3s1' sh -
[INFO] Using v1.24.4+k3s1 as release
[INFO] Downloading hash rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/v1.24.4-k3s1/sha256sum-amd64.txt
[INFO] Downloading binary rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/v1.24.4-k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Skipping /usr/local/bin/ctr symlink to k3s, command exists in PATH at /usr/bin/ctr
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
root@rancher-4:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
rancher-4 Ready control-plane,etcd,master 33s v1.24.4+k3s1
root@rancher-4:~# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-b96499967-frwhf 0/1 ContainerCreating 0 23s
kube-system helm-install-traefik-2nghc 0/1 ContainerCreating 0 24s
kube-system helm-install-traefik-crd-5pj2j 0/1 ContainerCreating 0 24s
kube-system local-path-provisioner-7b7dc8d6f5-pdg5g 0/1 ContainerCreating 0 23s
kube-system metrics-server-668d979685-jrqck 0/1 ContainerCreating 0 23s
root@rancher-4:~# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-b96499967-frwhf 1/1 Running 0 2m50s
kube-system helm-install-traefik-2nghc 1/1 Running 1 (7s ago) 2m51s
kube-system helm-install-traefik-crd-5pj2j 0/1 Completed 0 2m51s
kube-system local-path-provisioner-7b7dc8d6f5-pdg5g 1/1 Running 0 2m50s
kube-system metrics-server-668d979685-jrqck 1/1 Running 0 2m50s
kube-system traefik-7cd4fcff68-l9qjs 0/1 ContainerCreating 0 0s
root@rancher-4:~#