一文了解kubernetes安装部署

1、环境初始化(所有节点都要操作)

(1) 此环境下安装k8s集群要求centos版本在7.5或以上。

[root@Master ~]#  cat /etc/redhat-release

CentOS Linux release 7.9.2009 (Core)

(2)添加主机名解析

[root@Master ~]# vim /etc/hosts

192.168.194.100 Master
192.168.194.101 node1
192.168.194.103 node3

(3)时间同步

1)使用软件包安装工具安装chrony和ntp

  • Arch Linux系列:
    sudo pacman -S ntp chrony
  • Debian系列:
    sudo apt install ntp chrony
  • Red Hat系列:
    sudo yum install ntp chrony
    或者
    sudo dnf install ntp chrony
[root@Master ~]# systemctl start chronyd
[root@Master ~]# systemctl enable chronyd
[root@Master ~]# date

(4)禁用防火墙服务

[root@Master ~]# systemctl stop firewalld
[root@Master ~]# systemctl disable firewalld
[root@Master ~]# systemctl stop iptables
[root@Master ~]# systemctl disable iptables

(5)禁用selinux

编辑 /etc/selinux/config 文件,修改SELINUX的值为disabled,注意修改完毕后需要重启linux服务。

[root@Master ~]# vim /etc/selinux/config
   SELINUX=disabled

(6)禁用swap分区

编辑分区文件 /etc/fstab,注释掉swap分区一行,注意修改完毕后需要重启linux服务。

[root@Master ~]# vim /etc/fstab
    UUID=e64931ff-6f96-4b05-838b-ebabaefe52e5 /boot  xfs     defaults        0 0
    #/dev/mapper/centos-swap swap                    swap    defaults        0 0

(7)修改linux的内核参数

echo vm.max_map_count=262144 >>  /etc/sysctl.conf
echo net.ipv6.conf.all.disable_ipv6 = 1 >>  /etc/sysctl.conf
echo net.ipv6.conf.default.disable_ipv6 = 1 >>  /etc/sysctl.conf
echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf
[root@Master ~]# sysctl -p

(8)重启服务器

完成以上步骤之后,需要重新启动linux系统。

[root@Master ~]# reboot
  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GeekInk失控

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值