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

推荐订阅源

WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
Schneier on Security
Schneier on Security
S
Schneier on Security
A
Arctic Wolf
L
LangChain Blog
T
Threatpost
GbyAI
GbyAI
V2EX - 技术
V2EX - 技术
Jina AI
Jina AI
U
Unit 42
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
Spread Privacy
Spread Privacy
F
Fortinet All Blogs
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
F
Full Disclosure
博客园 - 【当耐特】
S
Secure Thoughts
美团技术团队
N
News | PayPal Newsroom
爱范儿
爱范儿
Latest news
Latest news
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
S
Security @ Cisco Blogs
V
V2EX
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
腾讯CDC
The Hacker News
The Hacker News
V
Vulnerabilities – Threatpost
Cyberwarzone
Cyberwarzone
Google Online Security Blog
Google Online Security Blog
N
Netflix TechBlog - Medium
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Last Watchdog
The Last Watchdog
N
News and Events Feed by Topic
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Security Archives - TechRepublic
Security Archives - TechRepublic
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest

Alliot's blog

Docker 代理配置机制与作用域 Docker 代理配置机制与作用域 2025年底的安卓搞机备忘录 2025年底的安卓搞机备忘录 ArgoCD部署应用出现metadata.annotations过大问题 APC UPS更换电池校准容量 APC UPS更换电池校准容量 M1 Mac安装低版本Node.js M1 Mac安装低版本Node.js Ansible使用Bitwarden存储Vault密码 Ansible使用Bitwarden存储Vault密码 Cloudflare Tunnel前置代理支持 Cloudflare Tunnel前置代理支持 CDN场景下配置Vaultwarden启用fail2ban CDN场景下配置Vaultwarden启用fail2ban 中银香港丝滑开户总结 中银香港丝滑开户总结 从指定路径更新雷池WAF证书 从指定路径更新雷池WAF证书 AWS ECS使用EBS作为Volume AWS ECS使用EBS作为Volume 浅浅的调教一下国产智障电视 浅浅的调教一下国产智障电视 Nginx proxy_pass到AWS ALB的504问题 Nginx proxy_pass到AWS ALB的504问题 OpenV**手动指定路由规则 OpenV**手动指定路由规则 本地模拟CNAME解析 本地模拟CNAME解析 Nginx搭建WebDAV服务 Nginx搭建WebDAV服务 迎来船新版本的Hexo+NexT 迎来船新版本的Hexo+NexT 优雅的处理Git多帐号与代理问题 优雅的处理Git多帐号与代理问题 验光配镜扫盲 验光配镜扫盲 Prometheus relabel实现动态metrics path Prometheus relabel实现动态metrics path
ArgoCD部署应用出现metadata.annotations过大问题
Alliot · 2025-06-24 · via Alliot's blog

  使用 Argo CD 部署 kube-prometheus-stack 的时候,出现 the metadata.annotations is invalid: Too long: must have at most 262144 bytes 的问题,导致整个 Application 出现 Sync Error。 这是由于Kubernetes 对于 metadata.annotations 字段总长度有限制,通常不能超过262144字节(256KB),而执行 kubectl apply 时会在 annotation 中加入 last-applied-configuration, 从而导致 annotation 过大无法 apply。

解决方法

  最简单的就是使用 replace 代替 apply, 在 Argo CD 中可以在点击 Sync 时勾选 Replace
argocd replace sync
  不过需要注意的是,replace 会导致资源被硬替换,因此操作时需要小心谨慎判断资源对象。

  对于经常出现这种情况的资源,可以在 Argo CD 中指定 sync options:

1
2
3
4
5
6
7
8
9
10
11
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
...
spec:
...
syncPolicy:
...
syncOptions:
- CreateNamespace=true
- Replace=true

或者指定 Server-side Apply | Argo CD:

1
2
3
syncPolicy:
syncOptions:
- ServerSideApply=true

Server-side Apply 是 Kubernetes 1.18+ 推出的资源声明和变更机制,通过 API 服务器直接对资源做合并(而不是 kubectl 客户端先比对现状再上传补丁),并由集群服务器追踪每个字段的“所有权(field manager)”。

附:

createapplyreplace
操作类型仅创建智能合并(增量改)全量覆盖(硬替换)
资源存在报错合并变更全量覆盖
资源不存在创建创建报错
常用场合首次部署推荐日常维护紧急或特殊配置场景
推荐方式资源初次创建推荐CI/CD、日常用需注意字段丢失风险
  1. 资源首次上线时都可用 create
  2. 日常配置变更推荐 apply,避免参数丢失,支持声明式管理。
  3. replace 适合某些全字段强制替换的场合(如清除字段、重建),用错会丢配置。
client-side apply(默认)server-side apply (--server-side)
合并位置本地客户端合并API server(服务端)合并
字段所有者仅记录最后一次的 apply 用户细致记录每个字段被哪个 manager(如部署/人)管理
合并行为只考虑自己声明过的字段多人/多资源管理时,分字段tracing、预防误覆盖
冲突检测无法检测其他 manager 的变更冲突能检测字段级冲突,提示明确
YAML格式要求传统 YAML (kubectl.kubernetes.io/last-applied-configuration)也支持CRD和大对象,支持更复杂资源
推荐场景个人或单一CI流最常用团队多人、自动化、多系统联合写入的生产场景