BlueXIII's Blog

热爱技术,持续学习

0%

K8S离线部署笔记-1-操作系统配置

通用配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 配置网络
nmtui

# 配置hostname
hostnamectl set-hostname uat-native.yourcompany.com

# 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service

# 关闭SELINUX
getenforce
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

# 关闭Swap
swapoff -a
vi /etc/fstab
注释掉swap行

K8S特殊配置

1
2
3
4
5
6
7
8
9
10
# iptables不处理bridge数据
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

# 打开kubectl自动完成
echo "source <(kubectl completion bash)" >> ~/.bashrc
yum -y install bash-completion