不管哪台机子都要跑的

sudo apt-get update -y && sudo apt-get dist-upgrade -y && sudo apt autoremove -y

k8s安装

swapoff -a
echo 1 > /proc/sys/net/ipv4/ip_forwar

换源
https://www.cnblogs.com/leisurelylicht/p/Ubuntu-guo-nei-an-zhuang-kubernetes.html

sudo vim /etc/apt/sources.list.d/kubernetes.list
# 将下面的阿里源加入文件中
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main

apt udpate 会报错给一串key

运行下面两个指令,把key换成上面key的后8位

gpg --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
gpg --export --armor E084DAB9 | sudo apt-key add -
运行下面两个指令,把key换成上面key的后8位

apt-get update && apt-get install -y apt-get install -y kubelet=1.23.9-00 kubeadm=1.23.9-00 kubectl=1.23.9-00

配置

systemctl start kubelet
systemctl enable kubelet

apt install docker.io
docker --version

 vi /etc/docker/daemon.js
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": ["https://ud6340vz.mirror.aliyuncs.com"]
}
systemctl daemon-reload
systemctl restart docker
systemctl enable docker

echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables

kubeadm config images pull --image-repository=registry.aliyuncs.com/google_containers
kubeadm init --image-repository=registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16 

如果要机子加入集群别忘了配置Hosts

mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config

然后就是安装flannel,装完ok就行

标签: none

评论已关闭