一、部署环境
- VMware Workstation 10
- centos7
二、主机配置
主机名 | ip | cpu | ram |
master | 192.168.137.10 | 1 | 2G |
node1 | 192.168.137.11 | 1 | 2G |
node2 | 192.168.137.12 | 1 | 2G |
1、每台主机在 /etc/hosts 添加以下内容:
2、对三台主机进行免密设置:
1)、CentOS7默认没有启动ssh无密登录,去掉/etc/ssh/sshd_config其中1行的注释,每台服务器都要设置
#PubkeyAuthentication yes
然后重启ssh服务
systemctl restart sshd
2)、在master机器的/root执行:ssh-keygen -t rsa命令,一直按回车。三台机器都要执行。
[[email protected] ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory ‘/root/.ssh‘. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:aMUO8b/EkylqTMb9+71ePnQv0CWQohsaMeAbMH+t87M [email protected] The key‘s randomart image is: +---[RSA 2048]----+ | o ... . | | = o= . o | | + oo=. . . | | =.Boo o . .| | . OoSoB . o | | =.+.+ o. ...| | + o o .. +| | . o . ..+.| | E ....+oo| +----[SHA256]-----+
3)、在master上合并公钥到authorized_keys文件
[[email protected] ~]# cd /root/.ssh/ [[email protected] .ssh]# cat id_rsa.pub>> authorized_keys
4)、将master的authorized_keys复制到node1和node2节点
scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/ scp /root/.ssh/authorized_keys [email protected]:/root/.ssh/
三、部署k8s
原文地址:https://www.cnblogs.com/boshen-hzb/p/10073425.html
时间: 2024-11-09 23:45:43