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

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

博客园 - ZY.Zhou

windows10下docker启动失败原因定位 electron工程目录结构 centos7下安装redis集群 MAC精简动画效果 Big Sur dmg镜像制作macos安装盘 WINDOWS下编译BOOST_PYTHON MYSQL单服务器迁移数据到集群 Centos7 解决gcc 4.85版本,升级更改版本gcc ubuntu下载安装文件和依赖包 fortify的linux环境使用步骤 linux top命令VIRT,RES,SHR,DATA的含义 docker导出镜像并压缩 main.c ubuntu 20开启rc.local LINUX间SSH免密登录 QEMU KVM宿主机与客户机间共享目录 Ubuntu20.10减肥 ubuntu的kennel命令行在哪个文件?虚拟机没有开SSH和TELNET,怎么连? 车辆功能部分缩写
ubuntu 20.10上使用KVM安装K8S
ZY.Zhou · 2021-01-17 · via 博客园 - ZY.Zhou

三台KVM,分别是node0、node1、node2,使用ubuntu 20.10系统

node0是master,node1和node2是worker

以下是三台虚拟机上都有安装的组件

  • 禁止系统休眠

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

  • 禁止swap

swapoff -a

vi /etc/fstab,将swap那行注释掉

  • 安装docker

apt install docker

然后修改driver为systemd

 cat > /etc/docker/daemon.json
{
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "http://hub-mirror.c.163.com"
  ],
  "insecure-registries":[
    "http://registry.my-lnk.tech"
  ],
  "max-concurrent-downloads": 10,
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-level": "warn",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
    },
  "data-root": "/var/lib/docker",
  "storage-driver": "overlay2"
}
  • 安装kubelet kubeadm kubectl

apt update && apt install -y apt-transport-https

curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF

apt update

# 查看可安装版本
apt-cache madison kubelet

# 安装版本

apt install -y kubelet kubeadm kubectl

# 配置自启动
sudo systemctl enable kubelet && sudo systemctl start kubelet

以下是在MASTER上执行的命令,本次安装以1.20.2版本

export MASTER_IP=192.168.122.100    #MASTER主机的IP
export APISERVER_NAME=my.k8s.demo     #域名
export POD_SUBNET=10.100.0.1/16      #子网,可以不改
echo "${MASTER_IP} ${APISERVER_NAME}" >> /etc/hosts
curl -sSL https://kuboard.cn/install-script/v1.20.x/init_master.sh | sh -s 1.20.2

安装完成后,如果全部成功,执行如下命令生成JOIN码:

kubeadm token create --print-join-command
kubeadm join my.k8s.demo:6443 --token ollefx.h2sylxwwb04m6a0n --discovery-token-ca-cert-hash sha256:b941724b5f1a7970ee6929c9c8dc0130029b23ba5cc03ae2f825597363882fe8

以下是在两台worker上分别都执行:

export MASTER_IP=192.168.122.100
export APISERVER_NAME=my.k8s.demo
echo "${MASTER_IP} ${APISERVER_NAME}" >> /etc/hosts
kubeadm join my.k8s.demo:6443 --token ollefx.h2sylxwwb04m6a0n --discovery-token-ca-cert-hash sha256:b941724b5f1a7970ee6929c9c8dc0130029b23ba5cc03ae2f825597363882fe8

等待所有镜像下载完毕,如果成功后在MASTER上执行打印如下:

root@k8s-master:/mnt/share# kubectl get nodes
NAME         STATUS   ROLES                  AGE   VERSION
k8s-master   Ready    control-plane,master   76m   v1.20.2
k8s-node1    Ready    <none>                 34m   v1.20.2
k8s-node2    Ready    <none>                 33m   v1.20.2

定位问题:
查看启动日志:
journalctl -u kubelet -n 1000