码迷,mamicode.com
首页 > Web开发 > 详细

Centos7部署kubernetes准备工作(一)

时间:2018-06-11 10:55:01      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:lease   ddr   sysconf   abd   命令   扩展   hit   The   latest   

一、准备工作:
1、创建三台虚拟机:(在node1配置好环境,然后关机克隆出node2、node3、并修改网卡、主机名即可)
linux-node1.example.com 192.168.43.21
linux-node2.example.com 192.168.43.22
linux-node3.example.com 192.168.43.23
设置主机名:
[root@linux-node1 ~]# hostnamectl set-hostname linux-node1.example.com
2、配置IP:
[root@linux-node1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
BOOTPROTO=static
NAME=ens32
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.43.21
NETMASK=255.255.255.0
GATEWAY=192.168.43.2
DNS1=192.168.43.2
3、关闭NetworkManager、firewalld、selinux等
[root@linux-node1 ~]# systemctl disable NetworkManager
[root@linux-node1 ~]# systemctl disable firewalld
[root@linux-node1 ~]# vim /etc/selinux/config ---->SELINUX=enforcing
4、设置主机名解析:
[root@linux-node1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.43.21 linux-node1 linux-node1.example.com
192.168.43.22 linux-node2 linux-node2.example.com
192.168.43.23 linux-node3 linux-node3.example.com
5、安装epel扩展源和常用的命令
[root@linux-node1 ~]# yum install -y net-tools vim lrzsz tree screenlsof tcpdumpnc mtr nmap
6、安装Docker
[root@linux-node1 ~]# cd /etc/yum.repos.d/
[root@linux-node1 yum.repos.d]# yum install -y docker-ce
[root@linux-node1 yum.repos.d]# systemctl start docker
[root@linux-node1 yum.repos.d]# systemctl enabled docker
7、创建部署目录
[root@linux-node1 ~]# mkdir -p /opt/kubernetes/{cfg,bin,ssl,log} #cfg存放配置文件;bin存放二进制文件;ssl存放证书文件;log存放日志文件。
8、关机---克隆出两台linux-node2、linux-node3并修改主机名、网卡
linux-node2:
[root@linux-node1 ~]# shutdown -h now
[root@linux-node1 ~]# hostnamectl set-hostname linux-node2.example.com #修改主机名
[root@linux-node1 ~]# su -
[root@linux-node2 ~]# hostnamectl
Static hostname: linux-node2.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: 09bb654cb3f7445e9a9abd9dd32b9e2c
Boot ID: 939c901cfa7246dda1e90946ac6f3b08
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.el7.x86_64
Architecture: x86-64
[root@linux-node2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
BOOTPROTO=static
NAME=ens32
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.43.22
NETMASK=255.255.255.0
GATEWAY=192.168.43.2
DNS1=192.168.43.2
 
linux-node3:
[root@linux-node1 ~]# hostnamectl set-hostname linux-node3.example.com #修改主机名
[root@linux-node1 ~]# su -
[root@linux-node3 ~]# hostnamectl
Static hostname: linux-node3.example.com
Icon name: computer-vm
Chassis: vm
Machine ID: 09bb654cb3f7445e9a9abd9dd32b9e2c
Boot ID: 939c901cfa7246dda1e90946ac6f3b08
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.el7.x86_64
Architecture: x86-64
[root@linux-node3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
BOOTPROTO=static
NAME=ens32
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.43.23
NETMASK=255.255.255.0
GATEWAY=192.168.43.2
DNS1=192.168.43.2

Centos7部署kubernetes准备工作(一)

标签:lease   ddr   sysconf   abd   命令   扩展   hit   The   latest   

原文地址:https://www.cnblogs.com/xiaoliangxianshen/p/9165423.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!