# Kubernetes installation issue with kubeadm init

**URL:** <https://discuss.kubernetes.io/t/kubernetes-installation-issue-with-kubeadm-init/26785>\
**Category:** General Discussions\
**Tags:** deployment\
**Created:** [January 19, 2024, 9:15am UTC](https://discuss.kubernetes.io/t/kubernetes-installation-issue-with-kubeadm-init/26785 "2024-01-19T09:15:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naresh\_A](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/naresh_a/32/14075_2.png) [@Naresh\_A](https://discuss.kubernetes.io/u/Naresh_A)\
**Post date:** [January 19, 2024, 9:15am UTC](https://discuss.kubernetes.io/t/kubernetes-installation-issue-with-kubeadm-init/26785/1 "2024-01-19T09:15:48Z")

</div>

Asking for help? Comment out what you need so we can get more information to help you!

### Cluster information:

Kubernetes version:  
Cloud being used: (put bare-metal if not on a public cloud)  
Installation method: kubeadm  
Host OS: Ubuntu 22.04 LTS  
CNI and version: NA  
CRI and version:  
Docker Engine - Community Version: 24.0.7  
containerd: Version: 1.6.27

I have Installed docker, cri-dockerd and kubelet kubeadm kubectl  
started initiating the cluster with the below cmd  
kubeadm init --pod-network-cidr 10.244.0.0/16 --apiserver-advertise-address=HOSTIP --cri-socket=unix:///var/run/cri-dockerd.sock

getting ERROR:  
[init] Using Kubernetes version: v1.29.1  
[preflight] Running pre-flight checks  
error execution phase preflight: [preflight] Some fatal errors occurred:  
[ERROR CRI]: container runtime is not running: output: time=“2024-01-19T09:11:55Z” level=fatal msg=“validate service connection: validate CRI v1 runtime API for endpoint "unix:///var/run/cri-dockerd.sock": rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial unix /var/run/cri-dockerd.sock: connect: connection refused"”  
, 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

Docker and containerd daemons are running, but the kubelet is not running.  
kubelet Error:  
: E0118 10:11:36.691366 2383 run.go:74] “command failed” err="failed to load kubelet config file, path: /var/lib/kubelet/config.yaml, error: failed to l\>  
: kubelet.service: Main process exited, code=exited, status=1/FAILURE  
: kubelet.service: Failed with result ‘exit-code’.  
: kubelet.service: Scheduled restart job, restart counter is at 9

swap is deactivated,  
file /var/lib/kubelet/config.yaml is available in the location with the right permissions.

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

---

<div class="post-metadata">

**Author:** ![fox-md](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/fox-md/32/10613_2.png) [@fox-md](https://discuss.kubernetes.io/u/fox-md)\
**Post date:** [January 26, 2024, 8:35pm UTC](https://discuss.kubernetes.io/t/kubernetes-installation-issue-with-kubeadm-init/26785/2 "2024-01-26T20:35:27Z")

</div>

Hi,  
It seems that socket does not exist

> [@Naresh\_A](#):
>
> “transport: Error while dialing: dial unix /var/run/cri-dockerd.sock: connect: connection refused”

---

<div class="post-metadata">

**Author:** ![timwolfe94022](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/timwolfe94022/32/14319_2.png) [@timwolfe94022](https://discuss.kubernetes.io/u/timwolfe94022)\
**Post date:** [January 29, 2024, 2:48am UTC](https://discuss.kubernetes.io/t/kubernetes-installation-issue-with-kubeadm-init/26785/3 "2024-01-29T02:48:05Z")

</div>

From the errors you’ve provided, there are a couple of key issues that stand out:

1. **CRI (Container Runtime Interface) Error**: The error message regarding the CRI indicates that `kubeadm init` is unable to communicate with the container runtime through the specified `cri-dockerd` socket. This could be due to `cri-dockerd` not running or not being properly configured to work with Kubernetes.
2. **Kubelet Configuration Issue** : The error from the kubelet service suggests there’s a problem loading the kubelet config file. This might be due to incorrect configuration options within the file or issues with how the kubelet was set up or started.

---

<div class="post-metadata">

**Author:** ![timwolfe94022](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/timwolfe94022/32/14319_2.png) [@timwolfe94022](https://discuss.kubernetes.io/u/timwolfe94022)\
**Post date:** [January 29, 2024, 2:48am UTC](https://discuss.kubernetes.io/t/kubernetes-installation-issue-with-kubeadm-init/26785/4 "2024-01-29T02:48:40Z")

</div>

Let’s tackle these one by one:

### CRI Error Troubleshooting

- **Verify `cri-dockerd` is Running** : First, ensure that `cri-dockerd` is actually running. You can do this with a command like `systemctl status cri-dockerd` or by checking the process list.
- **Check `cri-dockerd` Configuration** : Make sure `cri-dockerd` is configured to use the `unix:///var/run/cri-dockerd.sock` socket. You might need to review the `cri-dockerd` configuration file or documentation to ensure it’s set up correctly.
- **Docker Compatibility** : Since Docker is no longer the default container runtime for Kubernetes and you’re using `cri-dockerd` to bridge that gap, double-check that all components are compatible with your Kubernetes version.

### Kubelet Configuration Issue

- **Review Kubelet Config** : The error message suggests there’s an issue with `/var/lib/kubelet/config.yaml`. Review this file for any obvious misconfigurations. Ensure that all specified paths, certificates, and other configurations are correct.
- **Restart Kubelet** : If the configuration looks correct, try restarting the kubelet service with `sudo systemctl restart kubelet` and check its status again to see if the error persists.
- **Kubelet Logs** : For more detailed information, examine the kubelet logs using `journalctl -u kubelet`. This might provide more insight into what’s causing the kubelet to fail.

### General Troubleshooting Steps

- **Check System Requirements** : Ensure your system meets all the prerequisites for running Kubernetes, such as CPU, RAM, and network configurations.
- **Firewall and Networking** : Verify that no firewall rules are blocking communication between Kubernetes components. Also, ensure your network configuration (like the `--pod-network-cidr`) doesn’t conflict with existing network infrastructure.
- **Dependencies** : Make sure all necessary dependencies for `kubeadm`, `kubelet`, and `kubectl` are installed and up to date.
- **Clean Slate** : If you continue to face issues, consider resetting your kubeadm setup with `kubeadm reset`, which cleans up your current setup, and try initializing the cluster again. Be cautious with this command, as it will remove your current Kubernetes setup.

Remember, setting up Kubernetes can sometimes feel like fitting puzzle pieces together, and issues like these are part of the journey. Take it step by step, and you’ll get there! If you hit another roadblock or have more details to share, feel free to reach out.
