- Published on
Kubernetes Quickly Install Use Kubeadm
- Authors
- Name
- Yuchen Wei
Installation Environment
- The operating system is Centos7.
- Requires a minimum of 20GB hard disk storage.
- Needs to be connected to the internet.
Install Docker
Execute the following command.
sudo yum install -y yum-utils
sudo yum-config-manager \ --add-repo \ https://download.daocloud.io/docker/linux/centos/docker-ce.repo
sudo yum installdocker-ce
Install Kubernetes
Prepare the binary file
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
Install the necessary components."
yum install kubelet-1.17.17-0 kubeadm-1.17.17-0 kubectl
Disable the firewall and the swap partition.
systemctl stop firewalld
swapoff -a
Install kubernetes through kubeadmin
kubeadminit --image-repository=daocloud.io/daocloud --kubernetes-version=v1.17.3 --pod-network-cidr=10.252.0.0/16 --upload-certs
Configure kubectl
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudochown $(id -u):$(id -g) $HOME/.kube/config
Install CNI
Install calico CNI
kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
Remove The Taint
Allow the master node to also run pods.
kubectl taint <node name>node-role.kubernetes.io/master:NoSchedule-