抱着學習的态度,我想在自己家的ubuntu16.04安裝kubernetes。記錄一下我在過程中遇到的問題。
- 之前機器用kubeadm安裝過,需要清除幹淨
- apt-get update更新源出現的問題
- 安裝kubernetes
一、清除之前的kubeadm安裝kubernetes叢集
kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*
sudo apt-get autoremove
sudo rm -rf ~/.kube
二、apt-get update報錯
The repository '
https://apt.dockerproject.org/repoubuntu-xenial Release' does not have a Release file
首先我懷疑是國内的網絡,是以更新使用阿裡雲的源
sudo vi /etc/apt/source.list 更改内容如下
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
依然報錯,直接懵逼
查了很多文章,這兩個文章最後解決了我的問題
https://stackoverflow.com/questions/41133455/docker-repository-does-not-have-a-release-file-on-running-apt-get-update-on-ubun
https://www.it-swarm.dev/zh/ubuntu/docker%E5%AD%98%E5%82%A8%E5%BA%93%E5%9C%A8ubuntu%E4%B8%8A%E8%BF%90%E8%A1%8Captget-update%E6%97%B6%E6%B2%A1%E6%9C%89%E5%8F%91%E5%B8%83%E6%96%87%E4%BB%B6/828859551/
按照下面步驟解決報錯,apt-get update可以了
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | Sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
xenial \
stable"
sudo apt-get update
三、安裝kubernetes
之前安裝kubeadm使用起來非常麻煩,因為apiserver、controller、manage這些都是使用靜态pod啟動的,一旦出現問題修改非常麻煩。特别我之前遇到的問題是隻有kubelet還活着,controller死了,是以不能排程,但apiserver也沒了。想把他們拉起來非常麻煩。後來找到這個工具安裝非常友善