Document official website: HTTPS: //www.cnrancher.com/docs/rancher/v2.x/cn/overview/
1, ready to work
server three 8G, 2c otherwise initialization error, suggesting the need at least 2core
192.168.65.142 node2
192.168.65.140 Master
192.168.65.141 node1
192.168.65.143 Harbor
yum install -y conntrack ntpdate ntp ipvsadm ipset jq iptables curl sysstat libseccomp wget
closed swap
swapoff -a
also modify / etc / fstab comment swap boot
to ensure that time is synchronized ntpd
modify the host name, and added to the / etc / hosts
to upgrade the kernel
--import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org RPM
yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
Kernel---enablerepo = ELRepo yum the install -Y-Kernel lt
grub2 0-SET-default
after restarting view
[the root @ Master yum.repos.d] # the uname -R & lt
4.4.186-1.el7.elrepo.x86_64
closed numa
/etc/default/grub{,.bak} CP
Vim / etc / default / GRUB # `numa = off` added GRUB_CMDLINE_LINUX line parameters
, as follows:
the diff /etc/default/grub.bak / etc / default / GRUB
6c6
< GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rhgb quiet"
---
> GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rhgb quiet numa=off"
cp /boot/grub2/grub.cfg{,.bak}
grub2-mkconfig -o /boot/grub2/grub.cfg
2、安装docker
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install docker-ce -y
systemctl enable docker && systemctl start docker
[root@master sysconfig]# docker --version
Docker version 19.03.1, build 74b1e89
vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry 192.168.65.143
systemctl restart docker
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:stable
https://192.168.65.140/g/clusters
The cluster is done, click the host can see both the host added, I added two hosts here
Click Cluster> Information kubectl execute the command line you can use kubectl command to view the host of the
But to use kubect on the host is not seen. Tip command not found
Installation kubectl
Download the executable file kubectl
https://www.cnrancher.com/docs/rancher/v2.x/cn/install-prepare/download/kubernetes/
[root@master opt]# cp linux-amd64-v1.15.1-kubectl /usr/bin/kubect
kubeconfig figure below points to open the file
Tip ~. / Kube / config to add the configuration file, and paste the contents of the
[root@master .kube]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready controlplane,etcd,worker 3h42m v1.14.3
node1 Ready controlplane,etcd,worker 3h29m v1.14.3
[root@master .kube]#