惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
Malwarebytes
Malwarebytes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
F
Future of Privacy Forum
C
Cisco Blogs
T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
S
Securelist
K
Kaspersky official blog
S
Schneier on Security
T
ThreatConnect
T
Tenable Blog
Spread Privacy
Spread Privacy
T
True Tiger Recordings
AWS News Blog
AWS News Blog
F
Fox-IT International blog
量子位
T
Threatpost
V
Vulnerabilities – Threatpost
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
GbyAI
GbyAI
宝玉的分享
宝玉的分享
腾讯CDC
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
Cyberwarzone
Cyberwarzone
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
U
Unit 42
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
小众软件
小众软件
A
About on SuperTechFans
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
美团技术团队
Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog

博客园 - koushr

mysql json函数 group by的列、where的列的有效性 go基础第六篇:sync包 doris脚本 es es查询语法 veo ride nacos 枫叶互动 极光矩阵 富途 移卡科技 nginx高可用 k8s第一篇:k8s集群架构组件 架构设计第二篇:支付模块架构设计 可观测性体系设计第一篇:可观测性体系基本概念 架构设计第一篇:点赞模块功能设计 ES高级第一篇:倒排索引 山海星辰 python第一篇:基础语法 pulsar基础第二篇:命令行 pulsar基础第一篇:pulsar安装及基本概念 clickhouse第三篇:安装 clickhouse第二篇:MergeTree引擎 clickhouse第一篇:引擎 redis高阶第一篇:令牌桶算法限流 - koushr http2.0 gin入参多次获取 docker第二篇:docker安装常用中间件 https
k8s 1.18.0安装
koushr · 2026-05-25 · via 博客园 - koushr

一、在每个机器上执行:
1、设置时区。

2、配置静态ip:

vi /etc/sysconfig/network-scripts/ifcfg-ens33
①、把dhcp改成static
②、把ipv6都注释掉
③、在最后新增
IPADDR="192.168.189.128"
NETMASK="255.255.255.0"
GATEWAY="192.168.189.2"
DNS1="8.8.8.8"
DNS2="114.114.114.114"

假设master的静态ip是192.168.189.128,两个node的静态ip分别是192.168.189.129、192.168.189.130。

重启,用xshell连接。

3、设置hostname和hosts

vi /etc/hostname

vi /etc/hosts

4、关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

5、

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

6、关闭swap

vim /etc/fstab,把swap一行注释掉

7、

cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

8、

sed -i.bak \
-e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' \
/etc/yum.repos.d/CentOS-*.repo

yum clean all
yum makecache

9、安装docker

wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

yum -y install docker-ce-18.06.1.ce-3.el7

cat > /etc/docker/daemon.json << EOF

{

    "registry-mirrors": [
        "https://docker.1panel.top",
        "https://docker.m.daocloud.io",
        "https://docker.1ms.run",
        "https://docker.ketches.cn"
    ],
    "exec-opts": [
        "native.cgroupdriver=systemd"
    ]
}

EOF

systemctl enable docker && systemctl start docker

10、安装k8s

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

yum install -y kubelet-1.18.0 kubeadm-1.18.0 kubectl-1.18.0,-1.18.0是指定版本,如果不指定版本,则可以去掉-1.18.0

systemctl enable kubelet

重启

二、在master机器上执行

1、初始化

kubeadm init --apiserver-advertise-address=192.168.189.128 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.18.0 --service-cidr=10.96.0.0/12 --pod-network-cidr=10.244.0.0/16

apiserver-advertise-address是master机器的ip,要根据实际调整。

2、

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

3、

kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml

三、在各node机器上执行

1、加入cluster

kubeadm join 192.168.189.128:6443 --token njrbso.r3uzftzzkstwpxb9 \

--discovery-token-ca-cert-hash sha256:d850a038fd753e0fcb495088e2c431944f1eb39a719428a83762b68d1dc41ebf

以上完整的join命令可以在master初始化后的日志中看到。