k8s optimization - pre-environment configuration centos7

http://mirror.centos.org/centos/7/os/x86_64/Packages/socat-1.7.3.2-2.el7.x86_64.rpm
https://blog.csdn.net/qq_41472891/article/details/123016824
•安装步骤
yum -y install ntpdate
ntpdate time.windows.com
systemctl stop firewalld
systemctl disable firewalld
sed -i ‘s/enforcing/disabled/’ /etc/selinux/config
setenforce 0
sed -ri ‘s/.swap./#&/’ /etc/fstab
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system

rpm -ivh socat-1.7.3.2-2.el7.x86_64.rpm

++++++++++++++++

step 1: Install some necessary system tools

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

sudo yum makecache fast
sudo yum -y install docker-ce

sudo systemctl start docker
sudo systemctl enable docker
sed -i “13i ExecStartPost=/usr/sbin/iptables -P FORWARD ACCEPT” /usr/lib/systemd/system/docker.service

Generally, k8s.gcr.io cannot be accessed in China, so a domestic mirror hosting site needs to be configured

By default, Kubernetes sets the cgroup driver bit to "systemd", while the default cgroup driver of the Docker service is "cgroupfs", it is recommended to change it to "systemd", consistent with Kubernetes

tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [“https://bk6kzfqm.mirror.aliyuncs.com”],
“exec-opts”: [“native.cgroupdriver=systemd”],
“log-driver”: “json-file”,
“log-opts”: {
“max-size”: “100m”
},
“storage-driver”: “overlay2”,
“storage-opts”: [
“overlay2.override_kernel_check=true”
]
}
EOF
systemctl daemon-reload
systemctl restart docker

Configure the yum source (domestic), and select the appropriate source according to the needs

cat < /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF

Guess you like

Origin blog.csdn.net/qq_44912603/article/details/127048181