Kubernetes云平台部署

前提准备

双节点部署:

ip地址                     主机名                    节点
10.30.59.206              master                  master节点
10.30.59.218               node                    node节点

注意:
(1)所有节点必须是CentOS_7.5.1804系统,保持网络畅通
(2)docker的版本是Docker 18.09
(3)硬件配置:2GB或更多RAM,2个CPU或更多CPU,硬盘30GB或更多

1.环境配置

(1)配置Yum源
两个节点改名并将提供的压缩包K8S.tar.gz上传至/root目录并解压

[root@localhost ~]# hostname master
[root@localhost ~]# bash
[root@master ~]# ls
anaconda-ks.cfg  K8S.tar.gz
[root@master ~]# tar -zxf K8S.tar.gz 

[root@localhost ~]# hostname node
[root@localhost ~]# bash
[root@node ~]# ls
anaconda-ks.cfg  K8S.tar.gz
[root@node ~]# tar -zxf K8S.tar.gz 

两个节点配置yum源
①使用tar包做yum源
上传K8S.tar.gz和Docker.tar.gz这两个tar包并解压到opt下

[root@master ~]# vi /etc/yum.repos.d/local.repo

[K8s]
name=K8s
baseurl=file:///opt/Kubernetes
gpgcheck=0
enabled=1
[docker]
name=docker
baseurl=file:///opt/Docker
gpgcheck=0
enabled=1

②这是我用的一个同学的ftp共享

[root@master ~]# vi /etc/yum.repos.d/local.repo
[docker]
name=docker
baseurl=ftp://10.30.59.193/Docker
gpgcheck=0
enabled=1
[k8s]
name=k8s
baseurl=ftp://10.30.59.193/Kubernetes
gpgcheck=0
enabled=1

清除一下缓存,并重新加载一下

[root@master ~]# yum clean all
[root@master ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                                                        repo name                                                                         status
base/7/x86_64                                                                  CentOS-7 - Base                                                                   10,072
docker                                                                         docker                                                                               341
extras/7/x86_64                                                                CentOS-7 - Extras                                                                    498
k8s                                                                            k8s                                                                                  341
updates/7/x86_64                                                               CentOS-7 - Updates                                                                 2,189
repolist: 13,441

(2)升级系统内核(两个节点)

[root@master ~]# yum upgrade -y

(3)配置主机映射(两个节点)

[root@master ~]# vi /etc/hosts
10.30.59.206 master
10.30.59.218 node

(4)配置防火墙及SELinux(两个节点)

[root@master ~]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@master ~]# iptables -F
[root@master ~]# iptables -X
[root@master ~]# iptables -Z

[root@master ~]# iptables-save
# Generated by iptables-save v1.4.21 on Mon Jun  7 17:07:54 2021
*filter
:INPUT ACCEPT [30:2092]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [17:1820]
COMMIT
# Completed on Mon Jun  7 17:07:54 2021

[root@master ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@master ~]# reboot

(5)关闭Swap(两个节点)

[root@master ~]# swapoff -a

[root@master ~]# sed -i "s/\/dev\/mapper\/centos-swap/\#\/dev\/mapper\/centos-swap/g" /etc/fstab

(6)配置时间同步(两个节点安装chrony服务)


                
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值