A simple understanding docker and k8s
1、docker
- docker two sentences slogan:
The first sentence is "Build, Ship and the Run,"
"build, send, Run"
Can be understood, to build a house, I put this house packed into a mirror, in other places I want to build a house, do not need to re-build step by step, just before the image you want to send over, run it, so to get an identical house.
- The second slogan is: "Build once, Run anywhere
to build once, use everywhere
After the second sentence in the first sentence out of the lift, build this house, we only need to build one, it will be packaged into a mirror, you can send it to place a special management mirrored elsewhere need to build this house, just go download mirrors can be run directly use!
docker three core concepts:
- Image (Image): the outer container required for the provision of operational programs, libraries, resources, and other configuration files, it also includes a> some configuration parameters to prepare for a number of run-time (eg environment variables) | essentially fixed in accordance with commands packaged together in a sequence of packets (only a fixed frame, the content of which is fixed)
- Container (Container): the thing produced after running the mirror, like on the mirror after I run this house produced is a container
- Warehouse (Repository): a directory to put multiple mirrors (place)
2、k8s
k8s stands kubernetes, is a container-based cluster management platform .
- A k8s system, commonly referred to as a k8s cluster (cluster)
It consists of two parts:
- 1) a Master node (master node)
is responsible for the management and control - 2) a group of Node node (node calculation)
is the node workload, which is a specific container
Two, Docker + K8S build a clustered environment
1, all hosts turn off the firewall and SELinux
# systemctl stop firewalld
# getenforce
Disabled
2, showing the experimental environment
IP 主机名 角色
1.1.1.1 allen1 k8s-master RHEL7
1.1.1.2 allen2 k8s-node01 RHEL7
1.1.1.3 allen3 k8s-node02 CentOS7
It must be time synchronization between cluster
[root@allen1 ~]# for i in allen2 allen3;do echo $i && date;done && hostname && date
allen2
Fri May 31 11:46:46 CST 2019
allen3
Fri May 31 11:46:46 CST 2019
allen1
Fri May 31 11:46:46 CST 2019
3, yum source configuration (all nodes)
allen1(master):
# cd /etc/yum.repos.d/
# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# vim /etc/yum.repos.d/kubernetes.repo
1 [kubernetes]
2 name=Kubernetes Repo
3 baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
4 gpgcheck=1
5 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
6 enabled=1
# wget https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
# rpm --import yum-key.gpg
# wget https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
# rpm --import rpm-package-key.gpg
# scp docker-ce.repo kubernetes.repo allen2:/etc/yum.repos.d/
# scp docker-ce.repo kubernetes.repo allen3:/etc/yum.repos.d/
allen2 sum allen3 (node)
# wget https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
# rpm --import yum-key.gpg
# wget https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
# rpm --import rpm-package-key.gpg
4, each node installation software
# yum install -y docker-ce kubelet kubeadm kubectl
Each node starts docker
# systemctl daemon-reload
# systemctl start docker
# systemctl enable docker kubelet
# echo KUBELET_EXTRA_ARGS="--fail-swap-on=false" > /etc/sysconfig/kubelet
I did not do it, to be continued!