• K8S安装部署 初始化操作(一)


                  准备好服务器和服务器资源

    ip
    hostnameip资源 (2核2G也可以)
    k8s-master        192.168.37.1184核 4G 40G硬盘
    k8s-node1192.168.37.1192核 2G 20G硬盘
    k8s-node2192.168.37.1202核 2G 20G硬盘

    初始操作三台同时执行 

      1、关闭防火墙

    1. [root@localhost ~]# systemctl stop firewalld
    2. [root@localhost ~]# systemctl disable firewalld
    3. Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    4. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
    5. [root@localhost ~]# systemctl status firewalld
    6. ● firewalld.service - firewalld - dynamic firewall daemon
    7. Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
    8. Active: inactive (dead)
    9. Docs: man:firewalld(1)
    10. Jul 18 16:47:47 localhost.localdomain systemd[1]: Starting firewalld - dynam...
    11. Jul 18 16:47:48 localhost.localdomain systemd[1]: Started firewalld - dynami...
    12. Jul 18 16:47:48 localhost.localdomain firewalld[824]: WARNING: AllowZoneDrif...
    13. Jul 18 17:02:28 localhost.localdomain systemd[1]: Stopping firewalld - dynam...
    14. Jul 18 17:02:28 localhost.localdomain systemd[1]: Stopped firewalld - dynami...
    15. Hint: Some lines were ellipsized, use -l to show in full.
    16. [root@localhost ~]#

    2、关闭 selinux

    1. sed -i 's/enforcing/disable/' /etc/selinux/config
    2. [root@localhost ~]# cat /etc/selinux/config |grep disable
    3. # disable - SELinux security policy is enforced.
    4. # permissive - SELinux prints warnings instead of disable.
    5. # disabled - No SELinux policy is loaded.
    6. SELINUX=disable

    3、关闭swap分区 

           sed -ri 's/.*swap.*/#&/' /etc/fstab

    4、修改服务器名称

      hostnamectl set-hostname 

    添加hosts

    1. [root@localhost ~]# hostnamectl set-hostname k8s-master
    2. [root@localhost ~]# hostname
    3. k8s-master
    4. [root@localhost ~]# cat >> /etc/hosts
    5. hosts hosts.allow hosts.deny
    6. [root@localhost ~]# cat >> /etc/hosts <
    7. > 192.168.37.118 k8s-master
    8. > 192.168.37.119 k8s-node1
    9. > 192.168.37.120 k8s-node2
    10. > EOF
    11. [root@localhost ~]# cat /etc/hosts
    12. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    13. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    14. 192.168.37.118 k8s-master
    15. 192.168.37.119 k8s-node1
    16. 192.168.37.120 k8s-node2

    5、同步时间

       yum install ntpdate -y

          ntpdate time.windows.com
           18 Jul 17:24:47 ntpdate[17423]: adjust time server 52.231.114.183 offset 0.015404 sec

    6、IPv4流量传递到iptables的链

    1. [root@localhost ~]# cat > /etc/sysctl.conf/k8s.conf << EOF
    2. net.bridge.bridge-nf-call-ip6tables = 1
    3. net.bridge.bridge-nf-call-iptables = 1
    4. EOF
    5. cat /etc/sysctl.d/k8s.conf
    6. net.bridge.bridge-nf-call-ip6tables = 1
    7. net.bridge.bridge-nf-call-iptables = 1
    8. [root@k8s-master ~]# sysctl --system 执行生效
    9. * Applying /usr/lib/sysctl.d/00-system.conf ...
    10. * Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...

    7、重启服务器

    swap生效 即可
    [root@k8s-master ~]# free -m
                  total        used        free      shared  buff/cache   available
    Mem:           3770         266        3327          11         176        3293
    Swap:             0           0           0

    第二章 k8s环境部署

    http://t.csdn.cn/H27aW

  • 相关阅读:
    c#遍历文件重命名
    Flutter入门-Dart端和Native端的页面跳转
    sql跨表查询的三种方案
    浅谈windows提权
    python基于PHP+MySQL的在线考试系统
    MySQL中的Join 的算法(NLJ、BNL、BKA)
    从RNN到LSTM
    爬虫异常处理实战:应对请求频率限制和数据格式异常
    47.各种类型的线程池
    kernel 劫持seq_operations && 利用pt_regs
  • 原文地址:https://blog.csdn.net/m0_52454621/article/details/131791741