use kubeadm in lab only,,, do not use it in production
install docker 1.12.6 …..
please noted not install the lasted version.
- download kubernetes suits.
install from deb packages.
wget https://storage.googleapis.com/kubernetes-release/release/v1.6.3/bin/linux/amd64/kubectl
wget https://storage.googleapis.com/kubernetes-release/release/v1.6.3/bin/linux/amd64/kubeadm
wget https://storage.googleapis.com/kubernetes-release/release/v1.6.3/bin/linux/amd64/kubelet
wget https://storage.googleapis.com/kubernetes-release/release/v1.6.3/bin/linux/amd64/kubernetes-cni
sudo dpkg -i kubelet kubeadm kubectl kubernetes-cni
sudo apt-get install -f #install missed dependency
install from apt repository
switch to root
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
# Install docker if you don't have it already.
apt-get install -y docker-engine
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
- init cluster
sudo kubeadmin init
记住:在 加入节点前,先安装 网络插件
- install weave_net
kubectl apply -f https://git.io/weave-kube-1.6
- or install calico
kubectl apply -f http://docs.projectcalico.org/v2.2/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml
- if you have forgotten the token, can use following command to get token
sudo kubeadm token list
join node into cluster
sudo kubeadm join --token=604eff.a6a6b84b09e7682f 192.168.30.131:6443
使用上步骤取得的令牌
- install dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
- install heapter
clone heapster project into local dir, such as /opt/go/src/k8s.io/heapster/
go into heapster dirctory deploy
and run
bash kube.sh start # install heapster pod and service, and others.
- testing
kubectl cluster-info