Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Kubernetes manual building

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

01. System initialization and global variables

Host allocation

Hostnam

System

Ip address

Vip

Dev-k8s-master1

Centos7.6

172.19.201.244

172.19.201.242

Dev-k8s-master2

Centos7.6

172.19.201.249

Dev-k8s-master2

Centos7.6

172.19.201.248

Dev-k8s-node1

Centos7.6

172.19.201.247

Dev-k8s-node2

Centos7.6

172.19.201.246

Dev-k8s-node3

Centos7.6

172.19.201.243

Flanne

10.10.0.0/16

Docker

10.10.1.1/24

Hostnam

Set the permanent host name and log in again:

Hostnamectl set-hostname dev-k8s-master1

The set hostname is saved in the / etc/hostname file

Log in to other nodes without password ssh

Unless otherwise specified, all operations in this document are performed on the zhangjun-k8s01 node, and then the files are distributed and commands are executed remotely, so you need to add the ssh trust relationship from that node to other nodes.

Set the root account of zhangjun-k8s01 to log in to all nodes without a password:

Ssh-keygen-t rsa

Ssh-copy-id root@dev_k8s_master1

...

Update PATH variabl

Add the executable directory to the PATH environment variable:

Echo 'PATH=/opt/k8s/bin:$PATH' > > / root/.bashrc

Source / root/.bashrc

Install dependency packages

Install dependency packages on each machine:

CentOS:

Yum install-y epel-release

Yum install-y conntrack ntpdate ntp ipvsadm ipset jq iptables curl sysstat libseccomp wget

Turn off the firewall

Turn off the firewall on each machine, clean up the firewall rules, and set the default forwarding policy:

Systemctl stop firewalld

Systemctl disable firewalld

Iptables-F & & iptables-X & & iptables-F-t nat & & iptables-X-t nat

Iptables-P FORWARD ACCEPT

Close the swap partition

If swap partitions are turned on, kubelet will fail to boot (you can ignore swap on by setting the parameter-- fail-swap-on to false), so you need to turn off swap partitions on each machine. At the same time, annotate the corresponding entries in / etc/fstab to prevent swap partitions from being mounted automatically when powered on:

Swapoff-a

Sed-I'/ swap / s / ^\ (. *\) $/ #\ 1Universe g'/ etc/fstab

Close SELinux

Close SELinux, otherwise an error Permission denied may be reported when the directory is mounted by K8S:

Setenforce 0

Sed-I's / ^ Selinux =. * / SELINUX=disabled/' / etc/selinux/config

Load kernel module

Modprobe ip_vs_rr

Modprobe br_netfilter

Optimize kernel parameters

Cat > kubernetes.conf proxy-client-csr.json

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report