Kubernetes FAQs
crictl images Command Execution Failed
-
Applicable Version: Kubernetes 1.35.3, kernel version < 4.11
-
Error Message:
FATA[0000] validate service connection: validate CRI v1 image API for endpoint "unix:///run/containerd/containerd.sock": rpc error: code = Unimplemented desc = unknown service runtime.v1.ImageService -
Solution:
Disable the
enable_unprivileged_portsandenable_unprivileged_icmpsettings in containerd:# Check the current configurationgrep -nE 'unprivileged_(icmp|port)' /etc/containerd/config.toml# Set both options to falsesed -i \-e 's/^\(\s*enable_unprivileged_ports\s*=\s*\)true/\1false/' \-e 's/^\(\s*enable_unprivileged_icmp\s*=\s*\)true/\1false/' \/etc/containerd/config.toml# Verify the changesgrep -nE 'unprivileged_(icmp|port)' /etc/containerd/config.tomlsystemctl restart containerd-
After restarting, run the following command to verify plugin status. All plugins showing
okindicates normal operation:ctr plugin ls | grep -E 'cri|io.containerd.grpc.v1.cri'Expected output
io.containerd.cri.v1 images - okio.containerd.cri.v1 runtime linux/amd64 okio.containerd.grpc.v1 cri - ok
-
Calico Installation Failed
-
Applicable Version: Kubernetes 1.35.3
-
Error Message:
kubectl -n kube-system logs calico-node-xxx -c upgrade-ipamThis program can only be run on AMD64 processors with v2 microarchitecture support. -
Cause: The CPU does not support the x86-64-v2 architecture. Starting from Calico v3.31.1, only x86-64-v2 and above architectures are supported. Reference: Calico GitHub Issue #11352
-
Solution: Switch to Calico 3.30.7
-
Download and extract the installation package, then import the images
wget https://pdpublic.mingdao.com/private-deployment/offline/common/kubernetes-1.35.3/calico-3.30.7-yaml-images-amd64.tar.gztar xzvf calico-3.30.7-yaml-images-amd64.tar.gzcd calico-3.30.7-yaml-images-amd64gunzip -d calico-3.30.7-images-amd64.tar.gzctr -n k8s.io image import calico-3.30.7-images-amd64.tar -
Move calico.yaml to the installation directory
Run this command from within the
calico-3.30.7-yaml-images-amd64directorymv calico.yaml /usr/local/kubernetes/ -
Modify the configuration file
-
Replace the image registry address
sed -ri 's|image: docker.io/calico|image: 127.0.0.1:5000|g' /usr/local/kubernetes/calico.yamlgrep image: /usr/local/kubernetes/calico.yamlExample output
image: 127.0.0.1:5000/cni:v3.30.7image: 127.0.0.1:5000/cni:v3.30.7image: 127.0.0.1:5000/node:v3.30.7image: 127.0.0.1:5000/node:v3.30.7image: 127.0.0.1:5000/kube-controllers:v3.30.7 -
Configure the Pod CIDR
sed -ri '/# - name: CALICO_IPV4POOL_CIDR/,/# value: ".*"/ {s/# - name: CALICO_IPV4POOL_CIDR/- name: CALICO_IPV4POOL_CIDR/s/# value: ".*"/ value: "10.244.0.0\/16"/}' /usr/local/kubernetes/calico.yamlgrep -C 2 CALICO_IPV4POOL_CIDR /usr/local/kubernetes/calico.yamlExample output
# chosen from this range. Changing this value after installation will have# no effect. This should fall within `--cluster-cidr`.- name: CALICO_IPV4POOL_CIDRvalue: "10.244.0.0/16"# Disable file logging so `kubectl logs` works. -
Configure the CNI binary path
sed -i '/- name: cni-bin-dir/,/type:/s|path: .*|path: /usr/local/kubernetes/cni/bin|' /usr/local/kubernetes/calico.yamlgrep -C 2 cni-bin-dir /usr/local/kubernetes/calico.yamlExample output
name: host-local-net-dir- mountPath: /host/opt/cni/binname: cni-bin-dirsecurityContext:privileged: true--volumeMounts:- mountPath: /host/opt/cni/binname: cni-bin-dir- mountPath: /host/etc/cni/net.dname: cni-net-dir--path: /proc# Used to install CNI.- name: cni-bin-dirhostPath:path: /usr/local/kubernetes/cni/bin
-
-
Deploy Calico
kubectl apply -f /usr/local/kubernetes/calico.yaml
-
calico-node Pod Health Check Failed
-
Applicable Version: Kubernetes 1.35.3
-
Error Message:
Warning Unhealthy 115s kubelet Readiness probe errored and resulted in unknown state: rpc error: code = Unknown desc = failed to exec in container: failed to start exec "...": OCI runtime exec failed: exec failed: unable to start container process: error adding pid 23804 to cgroups: Unknown method 'AttachProcessesToUnit' or interface 'org.freedesktop.systemd1.Manager' -
Cause: The system does not support the
systemdcgroup driver; the cgroup drivers of containerd and kubelet are incompatible. -
Solution:
Switch the containerd cgroup driver from
systemdtocgroupfsand reinitialize the cluster:-
Modify the containerd configuration
sed -i 's/SystemdCgroup = true/SystemdCgroup = false/g' /etc/containerd/config.tomlgrep -n "SystemdCgroup" /etc/containerd/config.tomlsystemctl restart containerd -
Append the kubelet cgroup configuration to
kubeadm-config.yaml, then re-runkubeadm initto reinitializecd /usr/local/kubernetes/cat >> kubeadm-config.yaml <<'EOF'---apiVersion: kubelet.config.k8s.io/v1beta1kind: KubeletConfigurationcgroupDriver: cgroupfsEOF
-
Kubernetes 1.35.3 Installation Fails Because cgroups v1 Is Incompatible
-
Applicable Scenario: During the installation of
Kubernetes 1.35.3, the host still usescgroup v1, sokubeadm initfails during preflight checks. -
Error Message:
[WARNING SystemVerification]: kernel release 3.10.0-1160.el7.x86_64 is unsupported. Supported LTS versions from the 5.x series are 5.4, 5.10 and 5.15. Any 6.x version is also supported. For cgroups v2 support, the recommended version is 5.10 or newer[WARNING Hostname]: hostname "k8s-master-01" could not be reached[WARNING Hostname]: hostname "k8s-master-01": lookup k8s-master-01 on 172.17.30.241:53: server misbehaving[preflight] Some fatal errors occurred:[ERROR SystemVerification]: cgroups v1 support is deprecated and will be removed in a future release. Please migrate to cgroups v2.error: error execution phase preflight: preflight checks failed -
Cause:
- During the installation of
Kubernetes 1.35.3, support forcgroup v1is already limited in the preflight stage. - The host is currently using
cgroup v1. - If the environment cannot be switched to
cgroup v2, you need to switch toKubernetes 1.25.4and reinstall.
- During the installation of
-
Solution:
If the current environment must keep
cgroup v1, reset the Kubernetes cluster environment first, then switch the installation version from1.35.3to1.25.4and install again.If you need to continue installing
Kubernetes 1.35.3or a later version, switch the host tocgroup v2first, then run initialization again. -
How to Verify:
Check the
cgroupversion according to the current system.-
Check whether
cgroup v2orcgroup v1is enabledif [ -f /sys/fs/cgroup/cgroup.controllers ]; thenecho "cgroup v2"elseecho "cgroup v1"fiExample output:
- cgroup v2
- cgroup v1
cgroup v2cgroup v1 -
Check the current filesystem type
stat -fc %T /sys/fs/cgroupExample output:
- cgroup v2
- cgroup v1
cgroup2fstmpfs -
Optionally check the current process
cgroupinformationcat /proc/1/cgroupExample output:
- cgroup v2
- cgroup v1
0::/init.scope11:cpuacct,cpu:/10:perf_event:/9:devices:/8:blkio:/7:hugetlb:/6:cpuset:/5:memory:/4:freezer:/3:net_prio,net_cls:/2:pids:/1:name=systemd:/
-