kubernetes集群搭建(kubeadm,kubelet)

kubernetes集群搭建(kubeadm,kubelet)

Installing kubeadm on your hosts

Install and Set Up kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

chmod +x ./kubectl

sudo mv ./kubectl /usr/local/sbin/kubectl

To add kubectl autocompletion to your current shell, run source <(kubectl completion bash).
To add kubectl autocompletion to your profile, so it is automatically loaded in future shells run:

echo "source <(kubectl completion bash)" >> ~/.bashrc

install docker

Installing kubelet and kubeadm

You will install these packages on all of your machines:
kubelet: the component that runs on all of the machines in your cluster and does things like starting pods and containers.
kubeadm: the command to bootstrap the cluster.

If the machine is running CentOS, run:

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
        https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm
systemctl enable kubelet && systemctl start kubelet

Initializing your master

To initialize the master, pick one of the machines you previously installed kubeadm on, and run:

kubeadm init
原文地址:https://www.cnblogs.com/Ethan2lee/p/7546046.html