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

推荐订阅源

Vercel News
Vercel News
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google DeepMind News
Google DeepMind News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
N
News | PayPal Newsroom
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Help Net Security
Help Net Security
博客园 - Franky
SecWiki News
SecWiki News
Recent Announcements
Recent Announcements
T
Troy Hunt's Blog
The Register - Security
The Register - Security
The Last Watchdog
The Last Watchdog
Webroot Blog
Webroot Blog
S
Security Affairs
博客园 - 司徒正美
S
Schneier on Security
I
InfoQ
博客园_首页
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Threat Research - Cisco Blogs
Forbes - Security
Forbes - Security
腾讯CDC
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic
Cloudbric
Cloudbric
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
V
Vulnerabilities – Threatpost
C
Check Point Blog
Google DeepMind News
Google DeepMind News
Google Online Security Blog
Google Online Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cisco Blogs
Schneier on Security
Schneier on Security
O
OpenAI News
K
Kaspersky official blog

打工人日志

2026-05-28 打工人日报 2026-05-27 打工人日报 2026-05-26 打工人日报 2026-05-25 打工人日报 2026-05-24 打工人日报 2026-05-23 打工人日报 2026-05-22 打工人日报 2026-05-21 打工人日报 2026-05-20 打工人日报 2026-05-19 打工人日报 2026-05-18 打工人日报 2026-05-17 打工人日报 2026-05-16 打工人日报 2026-05-15 打工人日报 2026-05-14 打工人日报 2026-05-13 打工人日报 2026-05-12 打工人日报 2026-05-11 打工人日报 2026-05-10 打工人日报 2026-05-09 打工人日报 2026-05-08 打工人日报 2026-05-07 打工人日报 2026-05-06 打工人日报 2026-05-05 打工人日报 2026-05-04 打工人日报 2026-05-03 打工人日报 2026-05-02 打工人日报 2026-05-01 打工人日报 2026-04-30 打工人日报 2026-04-29 打工人日报 2026-04-28 打工人日报 2026-04-27 打工人日报 2026-04-26 打工人日报 2026-04-25 打工人日报 2026-04-24 打工人日报 2026-04-23 打工人日报 2026-04-22 打工人日报 2026-04-21 打工人日报 2026-04-20 打工人日报 2026-04-19 打工人日报 2026-04-18 打工人日报 2026-04-17 打工人日报 2026-04-16 打工人日报 2026-04-15 打工人日报 2026-04-14 打工人日报 2026-04-13 打工人日报 2026-04-12 打工人日报 2026-04-11 打工人日报 2026-04-10 打工人日报 2026-04-09 打工人日报 2026-04-08 打工人日报 2026-04-07 打工人日报 2026-04-06 打工人日报 2026-04-05 打工人日报 2026-04-04 打工人日报 2026-04-03 打工人日报 2026-04-02 打工人日报 2026-04-01 打工人日报 2026-03-31 打工人日报 2026-03-30 打工人日报 2026-03-29 打工人日报 2026-03-28 打工人日报 2026-03-27 打工人日报 2026-03-26 打工人日报 2026-03-25 打工人日报 2026-03-24 打工人日报 2026-03-23 打工人日报 2026-03-22 打工人日报 2026-03-21 打工人日报 2026-03-20 打工人日报 2026-03-19 打工人日报 2026-03-18 打工人日报 2026-03-17 打工人日报 2026-03-16 打工人日报 2026-03-15 打工人日报 2026-03-14 打工人日报 2026-03-13 打工人日报 2026-03-12 打工人日报 2026-03-11 打工人日报 2026-03-10 打工人日报 2026-03-09 打工人日报 2026-03-08 打工人日报 2026-03-07 打工人日报 2026-03-06 打工人日报 2026-03-05 打工人日报 2026-03-04 打工人日报 2026-03-03 打工人日报 2026-03-02 打工人日报 2026-03-01 打工人日报 2026-02-28 打工人日报 2026-02-27 打工人日报 2026-02-26 打工人日报 2026-02-25 打工人日报 2026-02-24 打工人日报 2026-02-23 打工人日报 2026-02-22 打工人日报 2026-02-21 打工人日报 2026-02-20 打工人日报 2026-02-19 打工人日报 2026-02-18 打工人日报
metallb + ingress-nginx + argocd 本地部署
2025-06-10 · via 打工人日志

环境准备(配置代理)

proxy_setting.yml

 1---
 2- name: 设置全局代理并测试连接
 3  hosts: all
 4  become: yes
 5  vars:
 6    proxy_host: "10.10.10.254"
 7    proxy_port: "7890"
 8    http_proxy: "http://{{ proxy_host }}:{{ proxy_port }}"
 9    https_proxy: "http://{{ proxy_host }}:{{ proxy_port }}"
10    no_proxy: "localhost,127.0.0.1"
11
12  environment:
13    http_proxy: "{{ http_proxy }}"
14    https_proxy: "{{ https_proxy }}"
15    no_proxy: "{{ no_proxy }}"
16
17  tasks:
18    - name: 显示代理设置
19      debug:
20        msg:
21          - "HTTP Proxy: {{ http_proxy }}"
22          - "HTTPS Proxy: {{ https_proxy }}"
23          - "NO_PROXY: {{ no_proxy }}"
24
25    - name: 使用 curl 测试外部连接(使用代理)
26      command: curl -I https://www.google.com
27      register: curl_result
28      ignore_errors: yes
29
30    - name: 显示 curl 测试结果
31      debug:
32        var: curl_result.stdout_lines

执行:

1ansible-playbook -i /etc/ansible/hosts proxy_setting.yml

kubespray 安装 k8s

1git clone --depth=1 https://github.com/kubernetes-sigs/kubespray.git
2cd kubespray
3pip install -r requirements.txt
4cp -rfp inventory/sample inventory/mycluster

修改 kubespray/inventory/mycluster/group_vars/k8s_cluster.yml

 1# 选择网络插件,支持 cilium, calico, weave 和 flannel
 2kube_network_plugin: cilium
 3
 4# 设置 Service 网段
 5kube_service_addresses: 10.233.0.0/18
 6
 7# 设置 Pod 网段
 8kube_pods_subnet: 10.233.64.0/18
 9
10# 支持 docker, crio 和 containerd,推荐 containerd.
11container_manager: containerd
12
13# 是否开启 kata containers
14kata_containers_enabled: false
15
16# 是否开启自动更新证书,推荐开启。
17auto_renew_certificates: true

修改 inventory/mycluster/inventory.ini

1[kube_control_plane]                                                                                                         
2node151 ansible_host=10.10.10.151                                                
3                                                                                                                             
4[etcd:children]                                                                                             
5
6kube_control_plane                                                                                                              
7[kube_node]    
8node152 ansible_host=10.10.10.152
9node153 ansible_host=10.10.10.152

执行部署

1sudo ansible-playbook \
2  -i inventory/mycluster/inventory.ini \
3  --private-key=~/.ssh/id_rsa \
4  --user=ubuntu -b \
5  cluster.yml
1kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.12/config/manifests/metallb-native.yaml

等待组件运行:

1kubectl get pods -n metallb-system

配置 IP 地址池 你需要指定一段在内网中未被使用的 IP 段(例如 10.10.10.170-10.10.10.180),MetalLB 会从中自动分配。

 1# metallb-config.yaml
 2apiVersion: metallb.io/v1beta1
 3kind: IPAddressPool
 4metadata:
 5  name: local-pool
 6  namespace: metallb-system
 7spec:
 8  addresses:
 9    - 10.10.10.170-10.10.10.180  # ← 修改为你的局域网可用 IP
10---
11apiVersion: metallb.io/v1beta1
12kind: L2Advertisement
13metadata:
14  name: l2adv
15  namespace: metallb-system

应用配置

1kubectl apply -f metallb-config.yaml

测试验证

 1# test-lb.yaml
 2apiVersion: v1
 3kind: Service
 4metadata:
 5  name: nginx-lb
 6spec:
 7  selector:
 8    app: nginx
 9  type: LoadBalancer
10  ports:
11    - name: http
12      port: 80
13      targetPort: 80
14---
15apiVersion: apps/v1
16kind: Deployment
17metadata:
18  name: nginx
19spec:
20  replicas: 1
21  selector:
22    matchLabels:
23      app: nginx
24  template:
25    metadata:
26      labels:
27        app: nginx
28    spec:
29      containers:
30        - name: nginx
31          image: nginx:alpine
32          ports:
33            - containerPort: 80

应用测试服务

1kubectl apply -f test-lb.yaml

检查服务状态

1kubectl get svc nginx-lb

安装 Ingress nginx

1kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.3/deploy/static/
2provider/cloud/deploy.yaml 

等待组件运行:

1kubectl get pods -n ingress-nginx
2kubectl get svc -n ingress-nginx

切换为loadBalancer

1kubectl patch svc ingress-nginx-controller -n ingress-nginx -p '{"spec": {"type": "LoadBalancer"}}'

安装 argocd

1kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

等待组件运行:

1kubectl get pods -n argocd

创建argocd-ingress.yaml

 1apiVersion: networking.k8s.io/v1
 2kind: Ingress
 3metadata:
 4  name: argocd-ingress
 5  namespace: argocd
 6  annotations:
 7    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
 8    nginx.ingress.kubernetes.io/ssl-redirect: "true"
 9spec:
10  ingressClassName: nginx
11  rules:
12    - host: argocd.k8s.com
13      http:
14        paths:
15          - path: /
16            pathType: Prefix
17            backend:
18              service:
19                name: argocd-server
20                port:
21                  number: 443
22  tls:
23    - hosts:
24        - argocd.k8s.com
25      secretName: argocd-tls

创建 TLS 证书 Secret

1openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
2  -out argocd.crt -keyout argocd.key \
3  -subj "/CN=argocd.k8s.com/O=ArgoCD"
4
5kubectl create secret tls argocd-tls \
6  --cert=argocd.crt --key=argocd.key \
7  -n argocd

应用 Ingress 配置

1kubectl apply -f argocd-ingress.yaml

添加 hosts 映射(本地访问)

1kubectl get svc -n ingress-nginx
1NAME                                 TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)                      AGE          
2ingress-nginx-controller             LoadBalancer   10.233.41.226   10.10.10.170   80:30776/TCP,443:30834/TCP   99m          
3ingress-nginx-controller-admission   ClusterIP      10.233.13.138                  443/TCP                      99m  

ingress-nginx 的 EXTERNAL-IP 是 10.10.10.170,你需要在本机添加:

110.10.10.170 argocd.k8s.com

获取初始密码

1kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

访问 ArgoCD 界面

https://argocd.k8s.com