Two, kubernetes build clusters

First, the preparatory work 

The main content of
 1 Environment preparation (2 hosts)
 2 . Installation Process
 3 . Analysis
 4 summarized 
environment configuration (2 hosts) 
System: CentOS 7.3 x64 
networks: local area network (VPC) 
Host: 
Master: 172.16 . 0.17  
the Node - 1 : 172.16 . 0.7

 

1. Host Requirements

 The hostname provided hostname- modify k8s-master and sudo vim / etc / hosts added 39.96.69.98 k8s-master

[root@k8s-master ~]#hostnamectl set-hostname k8s-master
echo "39.96.69.98   k8s-master" >> /etc/hosts

[root@k8s-node-1 ~]#hostnamectl set-hostname k8s-master
echo "39.96.69.98   k8s-master" >> /etc/hosts

2, modify the host configuration (master and host file node-1, so that each host name can be accessed by the host, to facilitate migration and update)

[root@k8s-master ~]#echo "39.96.69.98   k8s-master
47.94.174.85   k8s-node1" >> /etc/hosts

[root@k8s-node-1 ~]#echo "39.96.69.98   k8s-master
47.94.174.85   k8s-node1" >> /etc/hosts

  Note: There are n number of node on appending n.

3, closed

1, disable and turn off the firewall or directly word STOP firewalld & systemctl systemctl  disable firewalld

[root@k8s-master ~]# systemctl disable firewalld
[root@k8s-master ~]# systemctl stop firewalld
 
[root@k8s-node-1 ~]# systemctl disable firewalld
[root@k8s-node-1 ~]# systemctl stop firewalld

2, close SELinux (temporary shutdown, restart after failure)

[root@k8s-master ~]# setenforce 0
 
[root@k8s-node-1 ~]# setenforce 0

3, close swap (temporarily closed after the restart failure)

[root@k8s-master ~]# swapoff -a
 
[root@k8s-node-1 ~]# swapoff -a

Second, the installation kubeadm, kubelet and kubectl.

kubeadm: command to boot cluster, kubelet: Agent cluster to run the task, kubectl: command-line management tool

1, added Ali cloud YUM repositories

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
       http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

2, installation

yum -y install omelet kubeadm kubectl

3, start docker and kublet

systemctl start docker && systemctl enable docker
systemctl start kubelet && systemctl enable kubelet

Third, the first mirror to see what is required

List Images config kubeadm 
# following output 
k8s.gcr.io/kube-apiserver:v1. 12.2 
k8s.gcr.io/kube-controller-manager:v1. 12.2 
k8s.gcr.io/kube-scheduler:v1. 12.2 
K8S .gcr.io / Kube-Proxy: V1. 12.2 
k8s.gcr.io/pause: 3.1 
k8s.gcr.io/etcd: 3.2.24 
k8s.gcr.io/coredns: 1.2.2

Fourth, the installation Docker, and pull the mirror (two step)

 

5, consistent with the mater node to build the above step, following a node is created and the difference between master node:

 

 

 

 

 

 

 



Guess you like

Origin www.cnblogs.com/fger/p/10992485.html