docker安装完成后需要配置cgroup驱动为systemd来增强稳定性
sudo vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"registry-mirrors": ["https://9cpn8tt6.mirror.aliyuncs.com"]
}
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload
systemctl restart docker
/*暂时关闭*/
sudo swapoff -a
/*永久关闭*/
sudo vim /etc/fstab
ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
bash -c "echo 'Asia/Shanghai' > /etc/timezone"
apt-get install -y ntpdate
如果出现以下错误
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
执行2个命令解决
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
ntpdate ntp1.aliyun.com
sudo apt update && sudo apt install -y apt-transport-https curl
curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main" >>/etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubelet=1.15.2-00 kubeadm=1.15.2-00 kubectl=1.15.2-00
sudo apt-mark hold kubelet=1.15.2-00 kubeadm=1.15.2-00 kubectl=1.15.2-00
kubeadm init --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.19.4 | tee /etc/kube-server-key
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml
kubectl get pod -n kube-system
cat /etc/kube-server-key | tail -2
export KUBECONFIG=/etc/kubernetes/kubelet.conf
kubectl get nodes
apt-get install bash-completion
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
source ~/.bashrc
https://blog.csdn.net/qq_44895681/article/details/107414231
https://www.cnblogs.com/xiao987334176/p/11317844.html
https://blog.csdn.net/bigboygo/article/details/77119334
https://blog.csdn.net/woshiheweigui/article/details/109200180
手机扫一扫
移动阅读更方便
你可能感兴趣的文章