At least with MicroK8s 1.18 on Ubuntu 20.04, I found that a fix for this was to explicitly install Docker alongside Kubernetes.
Similar steps should apply to other Kubernetes distributions that don't include Docker.
After installing microk8s
, you can do the following to install Docker:
# Shut down microk8s
sudo snap disable microk8s
# Assuming no Docker installed yet - this fixes the case
# where Kubernetes results in this path being a directory
rm -rf /var/run/docker.sock
sudo apt-get install docker.io
ls -l /var/run/docker.sock
# Output should show socket not directory:
# srw-rw---- 1 root docker 0 Aug 6 11:50 /var/run/docker.sock
# (See https://docs.docker.com/engine/install/linux-postinstall/ for usermod + newgrp commands at this point)
# Restart microk8s
sudo snap enable microk8s
Other Kubernetes distributions may have a different way to shut down processes more selectively.
journalctl -xe
is useful to see any errors from Docker or Kubernetes here.
In Kubernetes manifests, be sure to use /var/run/docker.sock
as the host path when mounting docker.sock.
Related issues:
Post-install steps for Docker on Linux