Use kubeadm installation k8s 1.15.3 version
Environment initialization
- docker installation (slightly)
- Using yum installation kubeadm, kubelet, kubectl, arranged yum source (omitted)
yum install -y kubelet kubeadm kubectl
- Set bridge-nf-call-iptables
echo "1" > /proc/sys/net/bridge/bridge-nf-call-ip6tables
echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables
- View image files needed
kubeadm config images list
- Disable swap
swapoff -a
vim /etc/fstab
#/dev/mapper/centos-swap swap swap defaults 0 0
vim /etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS="--fail-swap-on=false"
installation
kubeadm init --image-repository registry.aliyuncs.com/google_containers --kubernetes-version=v1.15.3 --pod-network-cidr=10.10.0.0/16 --service-cidr=10.20.0.0/12 --apiserver-advertise-address=172.28.128.3
# --image-repository registry.aliyuncs.com/google_containers 设置阿里镜像源
# --kubernetes-version=v1.15.3 设置k8s版本
# --pod-network-cidr=10.10.0.0/16 --service-cidr=10.20.0.0/12 设置pod的子网地址和service 的子网地址
# --apiserver-advertise-address=172.28.128.3 设置为本机网卡IP地址
>>>
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 172.28.128.3:6443 --token vwdg2q.30zc380zz9lia98p \
--discovery-token-ca-cert-hash sha256:d5f93bb4c2eabe5986d575b808b91dc7be9bcb22eafd93d67c00a3abb4ed0bfd
## kubectl认证,root用户
export KUBECONFIG=/etc/kubernetes/admin.conf
## 非root用户
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Network deployment flannel plug
- Get kube-flannel.yaml file https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml
- According flannel version of the file in the download mirrors https://quay.io/repository/coreos/flannel
or usedocker pull quay.io/coreos/flannel:v0.11.0-arm64
- Deployment flannel
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Add node node
- Ibid environment initialization
- Use
kubeadm join 172.28.128.3:6443 --token vwdg2q.30zc380zz9lia98p \ --discovery-token-ca-cert-hash sha256:d5f93bb4c2eabe5986d575b808b91dc7be9bcb22eafd93d67c00a3abb4ed0bfd
join master node
- View node information
kubectl get node