Use kubeadm installation k8s 1.15.3 version

Use kubeadm installation k8s 1.15.3 version

Environment initialization

  1. docker installation (slightly)
  2. Using yum installation kubeadm, kubelet, kubectl, arranged yum source (omitted)
    yum install -y kubelet kubeadm kubectl
  3. 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
  4. View image files needed
    kubeadm config images list
  5. 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

  1. Get kube-flannel.yaml file https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml
  2. 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
  3. Deployment flannel
    kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Add node node

  1. Ibid environment initialization
  2. Use kubeadm join 172.28.128.3:6443 --token vwdg2q.30zc380zz9lia98p \ --discovery-token-ca-cert-hash sha256:d5f93bb4c2eabe5986d575b808b91dc7be9bcb22eafd93d67c00a3abb4ed0bfdjoin master node
  3. View node information
    kubectl get node

Guess you like

Origin www.cnblogs.com/dyb0204/p/11442077.html