Kubernetes, often abbreviated as K8s, is an open-source system for automating the deployment, scaling, and management of containerized containerized applications in an open source system. The system was designed by Google and donated to the Cloud Native Computing Foundation (Linux Foundation). It is designed to provide a platform for automated deployment, scaling, and running application containers across host clusters. It supports a range of container tools, including Docker and others.
In this article, we will explain how to resolve the error dial tcp 127.0.0.1:10248: connect: connection refused when kubeadm init is initialized.
dial tcp 127.0.0.1:10248: connect: connection refused
If you are trying to run Kubernetes and trying to initialize the Kubernetes cluster using
sudo kubeadm init, there is a high probability that you will get the following error.
The general idea is that connections to 127.0.0.1:10248 using the tcp protocol are being rejected. This is a cgroup driver issue. By default the Kubernetes cgroup driver is set to system, but docker is set to systemd. We need to change the Docker cgroup driver.
Use your favorite editor, but here in this tutorial use vim to create the configuration file
/etc/docker/daemon.json and add the following line.
You can also create a configuration file using the following command. Note that the following command will rewrite your configuration file.
In order for the configuration to take effect, you must restart docker and kubelet. you will run the following command to restart docker and kubelet.
Now, let’s try to reinitialize a Kubernetes cluster again, by running the following command.