images\cherry_red.png1 K8S(kubernetes)
      images\cherry_blue.png1.1 Kubernetes基础命令
      images\cherry_blue.png1.2 Kubernetes快速部署
      images\cherry_blue.png1.3 Kubernetes部署(Test)
      images\cherry_blue.png1.4 资源对象Kind
         images\cherry_orange.png1.4.1 Deployment对象
            images\cherry_cyan.png1.4.1.1 rollout
         images\cherry_orange.png1.4.2 自动扩缩容
      images\cherry_blue.png1.5 Kubernetes基本概念与术语
         images\cherry_orange.png1.5.1 Master
         images\cherry_orange.png1.5.2 Node
      images\cherry_blue.png1.6 集群部署3 Master 2 node
         images\cherry_orange.png1.6.1 kuber
         images\cherry_orange.png1.6.2 kubernetes高可用集群验证
测试实验,采用两台阿里云服务器进行测试实验

node1(master) 公网ip: 47.104.187.119 私网ip: 172.17.140.64
node1(work) 公网ip: 47.104.183.246 私网ip: 172.17.140.65

一般首先

两台主机需要进行kubernetes初始化配置

更改主机名
hostnamectl set-hostname node1(master)
hostnamectl set-hostname node2(work)

images\2-1.png


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


k8s开启的过程中可能是存在着端口号 【因为端口号起了冲突】,需要关闭防火墙限制等
或者,进入阿里云安全端口开启的一个情况

images\2-2.png


禁用防火墙

或者关闭防火墙
iptables -F
setenforce 0


vi /etc/selinux/config
images\2-3.png


注释掉SWAP自动挂载

vi /etc/fstab
images\2-4.png

注释掉虚拟交换内存


关闭虚拟交换内存
swapoff -a

创建配置k8s.conf文件
images\2-5.png

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
vm.swappiness=0

#################################################
cat > kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 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

#################################################

cp kubernetes.conf /etc/sysctl.d/kubernetes.conf
sysctl -p /etc/sysctl.d/kubernetes.conf

#################################################

modprobe br_netfilter
sysctl -p /etc/sysctl.d/k8s.conf



#################################################
调整系统默认的时区
timedatectl set-timezone Asia/Shanghai
timedatectl set-local-rtc 0
systemctl restart rsyslog
systemctl restart crond
#################################################
关闭系统不必要的服务
systemctl stop postfix && systemctl disable postfix



cat > /etc/sysconfig/modules/ipvs.modules <<EOF
#!/bin/bash
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack_ipv4

chmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack_ipv4

查看是否已经正确加载所需的内核模块
lsmod | grep -e ip_vs -e nf_conntrack_ipv4

安装ipset软件包
yum -y install ipset

查看ipvs的代理规则,安装管理工具ipvsadm
yum -y install ipvsadm


安装配置Docker运行环境,自己部署的脚本,安装配置