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

推荐订阅源

WordPress大学
WordPress大学
O
OpenAI News
Y
Y Combinator Blog
MyScale Blog
MyScale Blog
C
Check Point Blog
Vercel News
Vercel News
小众软件
小众软件
The Register - Security
The Register - Security
N
News and Events Feed by Topic
腾讯CDC
S
SegmentFault 最新的问题
H
Heimdal Security Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
S
Secure Thoughts
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Schneier on Security
Schneier on Security
G
GRAHAM CLULEY
云风的 BLOG
云风的 BLOG
S
Schneier on Security
J
Java Code Geeks
L
LINUX DO - 最新话题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Privacy & Cybersecurity Law Blog
Forbes - Security
Forbes - Security
Cisco Talos Blog
Cisco Talos Blog
L
LINUX DO - 热门话题
Scott Helme
Scott Helme
爱范儿
爱范儿
GbyAI
GbyAI
Simon Willison's Weblog
Simon Willison's Weblog
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric
W
WeLiveSecurity
The Hacker News
The Hacker News
V
V2EX
Last Week in AI
Last Week in AI
Hacker News: Ask HN
Hacker News: Ask HN
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
Cyberwarzone
Cyberwarzone
Google Online Security Blog
Google Online Security Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Security @ Cisco Blogs
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
U
Unit 42
Webroot Blog
Webroot Blog
Martin Fowler
Martin Fowler
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed

jobcher on 打工人日志

2023-12-21 打工人日报 2023-12-20 打工人日报 2023-12-19 打工人日报 2023-12-18 打工人日报 2023-12-17 打工人日报 2023-12-16 打工人日报 2023-12-15 打工人日报 2023-12-14 打工人日报 2023-12-13 打工人日报 2023-12-12 打工人日报 2023-12-11 打工人日报 2023-12-10 打工人日报 2023-12-09 打工人日报 2023-12-08 打工人日报 2023-12-07 打工人日报 2023-12-06 打工人日报 2023-12-05 打工人日报 2023-12-04 打工人日报 2023-12-03 打工人日报 2023-12-02 打工人日报 2023-12-01 打工人日报 2023-11-30 打工人日报 2023-11-29 打工人日报 2023-11-28 打工人日报 2023-11-27 打工人日报 2023-11-26 打工人日报 2023-11-25 打工人日报 2023-11-24 打工人日报 2023-11-23 打工人日报 2023-11-22 打工人日报 2023-11-21 打工人日报 2023-11-20 打工人日报 2023-11-19 打工人日报 2023-11-17 打工人日报 2023-11-16 打工人日报 2023-11-15 打工人日报 2023-11-14 打工人日报 2023-11-13 打工人日报 2023-11-12 打工人日报 2023-11-11 打工人日报 2023-11-10 打工人日报 2023-11-09 打工人日报 2023-11-08 打工人日报 2023-11-07 打工人日报 2023-11-06 打工人日报 2023-11-05 打工人日报 2023-11-04 打工人日报 2023-11-03 打工人日报 2023-11-02 打工人日报 2023-11-01 打工人日报 2023-10-31 打工人日报 2023-10-30 打工人日报 2023-10-29 打工人日报 2023-10-28 打工人日报 2023-10-27 打工人日报 2023-10-26 打工人日报 2023-10-25 打工人日报 2023-10-24 打工人日报 2023-10-23 打工人日报 2023-10-22 打工人日报 2023-10-21 打工人日报 2023-10-20 打工人日报 2023-10-19 打工人日报 2023-10-18 打工人日报 2023-10-17 打工人日报 2023-10-16 打工人日报 2023-10-15 打工人日报 2023-10-14 打工人日报 2023-10-13 打工人日报 2023-10-12 打工人日报 2023-10-11 打工人日报 2023-10-10 打工人日报 2023-10-09 打工人日报 2023-10-07 打工人日报 2023-10-06 打工人日报 2023-10-05 打工人日报 2023-10-04 打工人日报 2023-10-03 打工人日报 2023-10-02 打工人日报 2023-10-01 打工人日报 2023-09-30 打工人日报 2023-09-29 打工人日报 2023-09-28 打工人日报 2023-09-27 打工人日报 2023-09-26 打工人日报 2023-09-25 打工人日报 2023-09-24 打工人日报 2023-09-23 打工人日报 2023-09-22 打工人日报 2023-09-21 打工人日报 2023-09-20 打工人日报 2023-09-19 打工人日报 2023-09-18 打工人日报 2023-09-17 打工人日报 2023-09-16 打工人日报 2023-09-15 打工人日报 2023-09-14 打工人日报 2023-09-13 打工人日报 2023-09-12 打工人日报 2023-09-11 打工人日报
Kubernetes — RKE2 + kube-vip + cilium 部署
2025-09-18 · via jobcher on 打工人日志

准备工作

节点名称节点IP
k8s-master-110.10.10.151
k8s-master-210.10.10.152
k8s-master-310.10.10.153
kube-vip(虚拟IP)10.10.10.150

RKE 安装 rancher

在第一个 master 安装 RKE2 server

1# 安装 RKE2
2curl -sfL https://get.rke2.io | sh -

创建配置文件

1mkdir -p /etc/rancher/rke2/
1# 配置 server
2cat <<EOF >/etc/rancher/rke2/config.yaml
3write-kubeconfig-mode: "0644"
4tls-san:
5  - 10.10.10.150
6  - rancher.jobcher.com
7cni: cilium
8disable-kube-proxy: true
9EOF
1# 启动 server
2systemctl enable rke2-server --now
3systemctl status rke2-server
1ln -s /var/lib/rancher/rke2/bin/kubectl /usr/local/bin/kubectl
2echo 'export KUBECONFIG=/etc/rancher/rke2/rke2.yaml' >> ~/.bashrc
3source ~/.bashrc

kubectl 补全

1apt-get install -y bash-completion
1echo 'source <(kubectl completion bash)' >> ~/.bashrc
2source ~/.bashrc
3kubectl completion bash >/etc/bash_completion.d/kubectl
4source /etc/bash_completion.d/kubectl

cilium 安装

下载 Cilium CLI

1curl -L --remote-name https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz
2tar xzvf cilium-linux-amd64.tar.gz
3mv cilium /usr/local/bin/
4cilium version
1cilium status
2kubectl get pods -n kube-system -l k8s-app=cilium
3kubectl get nodes -o wide
1vim rke2-cilium-config.yml
 1# /var/lib/rancher/rke2/server/manifests/rke2-cilium-config.yml
 2apiVersion: helm.cattle.io/v1
 3kind: HelmChartConfig
 4metadata:
 5  name: rke2-cilium
 6  namespace: kube-system
 7spec:
 8  valuesContent: |-
 9    tunnelProtocol: geneve
10    kubeProxyReplacement: true
11    k8sServiceHost: localhost
12    k8sServicePort: 6443
13    hubble:
14      enabled: true
15      relay:
16        enabled: true
17      ui:
18        enabled: true    

配置 hubble-ui ,查看网络结构

1kubectl apply -f rke2-cilium-config.yml
2
3kubectl -n kube-system patch svc hubble-ui \
4  -p '{"spec": {"type": "NodePort"}}'

其他master 加入集群

获取token值

1cat /var/lib/rancher/rke2/server/node-token
1curl -sfL https://get.rke2.io | sh -
1mkdir -p /etc/rancher/rke2/
1cat <<EOF >/etc/rancher/rke2/config.yaml
2server: https://10.10.10.150:9345
3token: <token> # 输入token值
4tls-san:
5  - 10.10.10.150
6  - rancher.jobcher.com
7cni: cilium
8disable-kube-proxy: true
9EOF
1# 启动 server
2systemctl enable rke2-server --now
3systemctl status rke2-server

配置kubectl

1ln -s /var/lib/rancher/rke2/bin/kubectl /usr/local/bin/kubectl
2echo 'export KUBECONFIG=/etc/rancher/rke2/rke2.yaml' >> ~/.bashrc
3source ~/.bashrc
1kubectl get pod -n kube-system | grep kube-vip

kube-vip 安装

1KVVERSION=$(curl -sL https://api.github.com/repos/kube-vip/kube-vip/releases | jq -r ".[0].name")
1alias ctr="/var/lib/rancher/rke2/bin/ctr --address /run/k3s/containerd/containerd.sock"
1alias kube-vip="ctr image pull ghcr.io/kube-vip/kube-vip:$KVVERSION; ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip"
1wget https://kube-vip.io/manifests/rbac.yaml
2mv rbac.yaml kube-vip-rbac.yaml
3chmod +x kube-vip-rbac.yaml && kubectl apply -f kube-vip-rbac.yaml
 1# 运行
 2kube-vip manifest daemonset \
 3  --arp \
 4  --controlplane \
 5  --address 10.10.10.150\
 6  --interface eth0 \
 7  --leaderElection \
 8  --enableLoadBalancer \
 9  --inCluster \
10  --taint > kube-vip.yaml
1kubectl apply -f kube-vip.yaml

检测vip

1curl -k https://10.10.10.150:9345/v1-rke2/connect

rancher 安装

1curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
2
3helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
4helm repo update
5
6kubectl create namespace cattle-system
7kubectl -n cattle-system create secret tls tls-rancher-ingress --cert=fullchain.pem --key=privkey.pem
1helm upgrade --install rancher rancher-stable/rancher \
2  --namespace cattle-system \
3  --set hostname="rancher.jobcher.com" \
4  --set ingress.tls.source="secret" \
5  --set bootstrapPassword="输入你的密码"