举例来说:
$ sudo snap install kubectl --classic;
$ kubectl cluster-info dump;
The connection to the server localhost:8080 was refused - did you specify the right host or port?
$ ps -aux | grep kube;
$ lsb_release -a;
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
需要安装其他包或服务吗?我尝试安装kubeadm
:
$ sudo snap install kubeadm --classic;
$ sudo kubeadm init;
[init] Using Kubernetes version: v1.20.4
[preflight] Running pre-flight checks
[WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
...
$ sudo snap services;
Servicio Encendido Actual Notas
docker.dockerd activado activo -
kubelet.daemon activado inactivo -
$ sudo docker --version
Docker version 19.03.13, build cd8016b6bc
答案1
编辑 /etc/systemd/system/snap.docker.dockerd.service(或其他 snap docker 服务位置)添加以下行:
[Install]
Alias=docker.service
然后运行:
sudo systemctl reenable snap.docker.dockerd.service
sudo systemctl daemon-reload
sudo systemctl restart snap.docker.dockerd.service
就我而言,它起作用了。
韋斯