kairen / kubeadm-ansible

Build a Kubernetes cluster using kubeadm via Ansible.
Apache License 2.0
724 stars 379 forks source link

Container runtime error while executing site.yaml #86

Closed vinycoolguy2015 closed 3 years ago

vinycoolguy2015 commented 3 years ago

TASK [kubernetes/master : Init Kubernetes cluster] **** Tuesday 13 April 2021 09:09:51 +0000 (0:00:10.456) 0:01:31.555 ***** fatal: [10.128.0.5]: FAILED! => {"changed": true, "cmd": "kubeadm init --service-cidr 10.96.0.0/12 --kubernetes-version v1.19.2 --pod-network-cidr 10.244.0.0/16 --token b0f7b8.8d1767876297d85c --apiserver-advertise-address 10.128.0.5 --cri-socket=/var/run/containerd/containerd.sock \n", "delta": "0:00:10.188770", "end": "2021-04-13 09:10:01.929454", "msg": "non-zero return code", "rc": 1, "start": "2021-04-13 09:09:51.740684", "stderr": "W0413 09:09:51.799678 4261 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]\nerror execution phase preflight: [preflight] Some fatal errors occurred:\n\t[ERROR CRI]: container runtime is not running: output: NAME:\n crictl info - Display information of the container runtime\n\nUSAGE:\n crictl info [command options] [arguments...]\n\nOPTIONS:\n --output value, -o value Output format, One of: json|yaml (default: \"json\")\n \ntime=\"2021-04-13T09:10:01Z\" level=fatal msg=\"failed to connect: failed to connect: context deadline exceeded\"\n, error: exit status 1\n[preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=...\nTo see the stack trace of this error execute with --v=5 or higher", "stderr_lines": ["W0413 09:09:51.799678 4261 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]", "error execution phase preflight: [preflight] Some fatal errors occurred:", "\t[ERROR CRI]: container runtime is not running: output: NAME:", " crictl info - Display information of the container runtime", "", "USAGE:", " crictl info [command options] [arguments...]", "", "OPTIONS:", " --output value, -o value Output format, One of: json|yaml (default: \"json\")", " ", "time=\"2021-04-13T09:10:01Z\" level=fatal msg=\"failed to connect: failed to connect: context deadline exceeded\"", ", error: exit status 1", "[preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=...", "To see the stack trace of this error execute with --v=5 or higher"], "stdout": "[init] Using Kubernetes version: v1.19.2\n[preflight] Running pre-flight checks", "stdout_lines": ["[init] Using Kubernetes version: v1.19.2", "[preflight] Running pre-flight checks"]}

Sh4peSh1fter commented 3 years ago

Hey @vinycoolguy2015 , I got a similar error (I'm running it on Centos 7 VM's), and after looking carefully whar are the variables that passed in this command, I noticed that I have no /var/run/containerd/containerd.sock. The closest cri socket I found was docker.sock under /var/run.

In the Kubernetes official documentation, it's said that "If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket", so for me deleting this flag in the task worked just fine (both on the kubernetes/master/tasks/init.yml and kubernetes/node/tasks/join.yml).

I hope this will help you better understand and resolve the issue :)

vinycoolguy2015 commented 3 years ago

Yes, that's what I did, I removed that cri flag from all the files.