kubeadm 17.1 installation

This article describes kubernetes installation kubeadm

Installation premise:

1. Turn off the firewall, SELINUX swap, the mirror mounting aliyun epel-releases docker-ce kubernetes source

-o curl /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo

yum clean all && yum update -y && yum install wget net-tools vim bind-utils 

docker source

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum repolistcat

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=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

### installation docker-ce 19.03 version

yum install docker-ce -y

systemctl enable docker &&  systemctl start docker &&systemctl status docker 

#### installation k8s client management tools k8s

yum -y install omelet kubeadm kubectl

After ### kubelet need k8s other components will complain ready to open now open

systemctl enable kubelet 

### open iptables

echo 1 > /proc/sys/net/bridge/bridge-nf-calll-iptables

echo 1 > /proc/sys/net/bridge/bridge-nf-calll-ip6tables

sed -ri '/swap/s/(.*)+/#\1/g' /etc/fstab

sed -ri '$a\net.bridge.bridge-nf-call-iptables = 1' /etc/sysctl.conf

sed -ri '$a\net.bridge.bridge-nf-call-ip6tables = 1' /etc/sysctl.conf

### closed swap selinux

setenfor 0

sed -ri '/^SELINUX=/c\SELINUX=disabled' /etc/sysconfig/selinux 

swapoff -a

sed -r '/swap/s/(.*)+/#\1/g'  /etc/fstab

### one master one node1

hostname master

hostnamectl set-hostname master

cat / etc / hosts ## to modify the hosts file

### installation using kubeadm

kubeadm init --kubernetes-version=v1.17.3 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --ignore-preflight-errors=Swap --image-repository registry.aliyuncs.com/google_containers

### You can see whether the pull mirroring docker images

 

 

Execution ends ### join the access node uses the master node1

kubeadm join 192.168.1.29:6443 --token 6n3vod.cexl86ujrtndjeny     --discovery-token-ca-cert-hash sha256:46a3a793adc3eb8b5891e95bdf3433c3922789238b2336e659eb755ae038b684 

###

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

## network plug-in installation flannel

wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

kubectl create -f kube-flannel.yml

After ### other network plug up

kubectl get cs

 

 ####kubel get nodes

 

 ### default ignore this pod is created

kubectl get pods --all-namespaces

 

Guess you like

Origin www.cnblogs.com/AnyChen/p/12453828.html