一、修改主机名

hostnamectl set-hostname xxx

二、修改hosts文件vim /etc/hosts

三、将写好的hosts文件拷贝到其他节点

scp /etc/hosts  root@k8s-node01:/etc/hosts

四、安装依赖包

yum install -y conntrack ntpdate ntp ipvsadm ipset jq iptables curl sysstat libseccomp wgetvimnet-tools git

五、设置防火墙为 Iptables 并设置空规则(都执行)

//关闭防火墙&&防火墙自启

systemctl stop firewalld && systemctl disable firewalld

//安装Iptables管理工具&&启动Iptables&&设为Iptables开机自启&&清空Iptables规则&&保存Iptables默认规则

yum -y install iptables-services && systemctl start iptables && systemctl enable iptables&& iptables -F && service iptables save

六、关闭selinux

swapoff -a && sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab   

//关闭swap分区,永久关闭虚拟内存。K8s初始化init时,会检测swap分区有没有关闭,如果虚拟内存开启,容器pod就可能会放置在虚拟内存中运行,会大大降低运行效率

setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config

七、调整内核参数,对于k8s

cat > kubernetes.conf <<EOF

net.bridge.bridge-nf-call-iptables=1

net.bridge.bridge-nf-call-ip6tables=1

net.ipv4.ip_forward=1

net.ipv4.tcp_tw_recycle=0

vm.swappiness=0 # 禁止使用 swap 空间,只有当系统 OOM 时才允许使用它

vm.overcommit_memory=1 # 不检查物理内存是否够用

vm.panic_on_oom=0 # 开启 OOM

fs.inotify.max_user_instances=8192

fs.inotify.max_user_watches=1048576

fs.file-max=52706963

fs.nr_open=52706963

net.ipv6.conf.all.disable_ipv6=1

net.netfilter.nf_conntrack_max=2310720 

EOF 

其中必备参数

net.bridge.bridge-nf-call-iptables=1

net.bridge.bridge-nf-call-ip6tables=1  //开启网桥模式

net.ipv6.conf.all.disable_ipv6=1//关闭ipv6的协议

其余为优化参数,可不设置

cp kubernetes.conf /etc/sysctl.d/kubernetes.conf  //拷贝,开机能调用

sysctl -p /etc/sysctl.d/kubernetes.conf  //手动刷新

八、调整系统时区

//设置系统时区为中国/上海

timedatectl set-timezone Asia/Shanghai

//将当前的 UTC 时间写入硬件时钟

timedatectl set-local-rtc 0

// 重启依赖于系统时间的服务

systemctl restart rsyslogsystemctl restart crond

九、关闭系统不需要的服务

systemctl stop postfix && systemctl disable postfix

十、设置 rsyslogd 和 systemd journald

原因:centos7以后,引导方式改为了systemd,所以会有两个日志系统同时工作只保留一个日志(journald)的方法

mkdir /var/log/journal # 持久化保存日志的目录

mkdir /etc/systemd/journald.conf.d

cat  >  /etc/systemd/journald.conf.d/99-prophet.conf  <<EOF

[Journal]

#持久化保存到磁盘

Storage=persistent

# 压缩历史日志

Compress=yes

SyncIntervalSec=5m

RateLimitInterval=30s

RateLimitBurst=1000

# 最大占用空间10G

SystemMaxUse=10G

# 单日志文件最大200M

SystemMaxFileSize=200M

# 日志保存时间 2 周

MaxRetentionSec=2week

# 不将日志转发到 syslog

ForwardToSyslog=no

EOF

#重启journald配置

systemctl restart systemd-journald

十一、升级内核为4.4版本

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

# 安装完成后检查 /boot/grub2/grub.cfg 中对应内核 menuentry 中是否包含 initrd16 配置,如果没有,再安装一次!

yum --enablerepo=elrepo-kernel install -y kernel-lt

# 设置开机从新内核启动

grub2-set-default "CentOS Linux (4.4.182-1.el7.elrepo.x86_64) 7 (Core)"

 以上笔记根据尚硅谷官方k8s视频内容总结

链接:https://www.bilibili.com/video/av66617940/?p=7

第三章 k8s的node节点配置的更多相关文章

  1. raspberrypi系统在加入k8s作为node节点时遇到的问题

    新买的树莓派4b到货后就迫不及待的烧录上raspberrypi系统,将新派加入我的k8s集群,期间遇到了点小挫折,好歹也一个一个解决了: 一.kubelet版本不对导致无法加入k8s集群 在执行kub ...

  2. 第三章:Hadoop简介及配置Hadoop-1.2.1,hbase-0.94.13集群

    前面给大家讲了怎么安装Hadoop,肯定会有人还是很迷茫,装完以后原来就是这个样子,但是怎么用,下面,先给大家讲下Hadoop简介:大致理解下就OK了 hadoop是一个平台,提供了庞大的存储和并行计 ...

  3. 第三章 k8s cluster环境创建

    1  用如下方法安装指定版本的docker,但是我的环境会报错 # 安装rpm apt install rpm # 下载 RPM 包, docker 版本 wget https://download. ...

  4. ASP.NET Core 中文文档 第三章 原理(7)配置

    原文:Configuration 作者:Steve Smith.Daniel Roth 翻译:刘怡(AlexLEWIS) 校对:孟帅洋(书缘) ASP.NET Core 支持多种配置选项.应用程序配置 ...

  5. k8s的node节点无法调度的问题

    1.现象,创建deployment时 2.查看污点 [fedora@k8s-cluster--ycmwlao4q5wz-master- ~]$ kubectl describe node k8s-cl ...

  6. k8s的node节点,执行kubectl get XXX报错

    报错现象: [root@localhost ~]# kubectl get nodes The connection to the server localhost:8080 was refused ...

  7. jQuery复习:第二章&第三章

    第二章 一.选择器 1.层次选择器 $(“ancestor descendant”)选取ancestor元素里的所有后代元素 $(“parent > child”)选取parent元素下的chi ...

  8. K8s集群部署(三)------ Node节点部署

    之前的docker和etcd已经部署好了,现在node节点要部署二个服务:kubelet.kube-proxy. 部署kubelet(Master 节点操作) 1.二进制包准备 [root@k8s-m ...

  9. 三、安装并配置Kubernetes Node节点

    1. 安装并配置Kubernetes Node节点 1.1 安装Kubernetes Node节点所需服务 yum -y install kubernetes   通过yum安装kubernetes服 ...

随机推荐

  1. shell条件测试语句

  2. Tensorflow读取大数据集的方法,tf.train.string_input_producer()和tf.train.slice_input_producer()

    1. https://blog.csdn.net/qq_41427568/article/details/85801579

  3. java23种设计模式(一)-- 工厂模式、抽象工厂模式和单例模式

    一.工厂模式 1.定义统一的接口,并在接口中定义要实现的抽象方法. 2.创建接口的具体实现类,并实现抽象方法. 3.创建一个工厂类,根据传递的参数,生成具体的实现类对象,执行具体的方法. 优点: 1. ...

  4. 小程序内嵌H5页面判断微信及小程序环境

    判断微信及小程序环境 1.H5页面引入jweixin-1.3.2.js 2. var ua = window.navigator.userAgent.toLowerCase(); if(ua.matc ...

  5. C语言之——__attribute__

    __attribute__ ((packed)) 的作用就是告诉编译器取消结构在编译过程中的优化对齐,按照实际占用字节数进行对齐,是GCC特有的语法.这个功能是跟操作系统没关系,跟编译器有关 . __ ...

  6. SpringBoot2.0总结

    与SpringCloud关系 与SpringMVC关系 与JFinal区别 常用注解: @RestController  @EnableAutoConfiguration   @ComponentSc ...

  7. 根据mysql数据库 定义solr Schema.xml中配置业务域

    <!--product--> <field name="product_name" type="text_ik" indexed=" ...

  8. js 原生 document.querySelectorAll document.getElementsByTagName document.querySelector document.getElementById的区别

    1.querySelector只返回匹配的第一个元素,如果没有匹配项,返回null.  2.querySelectorAll返回匹配的元素集合,如果没有匹配项,返回空的nodelist(节点数组). ...

  9. TableStore最佳实践:轻松实现轨迹管理与地理围栏

    摘要: 基于TableStore轻松实现亿量级轨迹管理与地理围栏 一.方案背景 轨迹管理系统日常生活中使用非常普遍,如外卖派送轨迹.快递物流流转.车辆定位轨迹等.该场景与地理位置管理类似,核心点与瓶颈 ...

  10. %各位大佬的博客.tql

    线性基:https://www.cnblogs.com/ljh2000-jump/p/5869991.html#4219854 数位DP  https://blog.csdn.net/jk211766 ...