Home > database >  docker service is not enabled - Kubernetes
docker service is not enabled - Kubernetes

Time:03-13

I'm trying to install Kubernetes on an EC2 instance running Ubuntu 20.04.

I ran the following commands to install Kubeadm and Docker.

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo snap install docker
sudo kubeadm init

When I try to run Kubeadm init in order to initialize my Kubernetes control node, I get the following error:

[init] Using Kubernetes version: v1.23.4
[preflight] Running pre-flight checks
    [WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR Service-Docker]: docker service is not active, please run 'systemctl start docker.service'
[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

I subsequently checked to see if Docker was properly installed and pulled an Ubuntu 20.04 docker image and successfully ran it in interactive mode. So, I'm sure that Docker is running.

Does anyone have an idea as to what might be the issue?

My Kubeadm version is:

kubeadm version: &version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:36:57Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}

My Docker version is:

Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

CodePudding user response:

The issue was that I installed docker using snap.

This creates a service name that seems to cause issues with Kubernetes.

Install docker for Ubuntu 20.04 using directions on the official Docker website with apt-get. This seems to work.

  • Related