当前位置:网站首页>故障排查:kubectl报错ValidationError: unknown field \u00a0
故障排查:kubectl报错ValidationError: unknown field \u00a0
2022-07-02 17:07:00 【农民工老王】
博客主页:https://tomcat.blog.csdn.net
博主昵称:农民工老王
主要领域:Java、Linux、K8S
期待大家的关注点赞收藏留言
故障详情
最近在k8s集群上通过kubectl apply -f
部署资源时,遇到以下报错。当时也很快解决了。现记录下故障和排查方法,以方便遇到同样报错的开发者。
error: error validating “nfs.yaml”: error validating data: [ValidationError(ServiceAccount): unknown field “\u00a0\u00a0name” in io.k8s.api.core.v1.ServiceAccount, ValidationError(ServiceAccount): unknown field “\u00a0\u00a0namespace” in io.k8s.api.core.v1.ServiceAccount]; if you choose to ignore these errors, turn validation off with --validate=false
分析原因
报错信息已经描述得很清楚,是因为name前的“\u00a0\u00a0”两个字符导致的。通过查询资料得知,\u00a0 在 utf-8编码中,表示不间断空格,主要用在office中,让一个单词在结尾处不会换行显示。在word中,可以通过 ctrlshiftspace 输入。
我们在IDEA编辑器中打开nfs.yaml文件,然后查找空格,发现未匹配到name和所有表示缩进的空白字符。也验证了报错的提示信息。
用Sublime Text打开,更容易发现差异:
原来这个yaml文件中的内容是从一个word文件直接复制过来的,里面不小心就包含了一些\u00a0这一特殊空白字符。
解决故障
解决办法很简单,直接在编辑器里将\u00a0替换成普通空格就可以,IDEA,Sublime Text都可以很方便实现。
替换后就可以顺利部署。
如需转载,请注明本文的出处:农民工老王的CSDN博客https://blog.csdn.net/monarch91 。
边栏推荐
- NVIDIA graphics card failed to initialize nvml driver/library version mismatch error solution
- 再放宽!这些应届生,可直接落户上海
- 1.5.1版本官方docker镜像运行容器,能设置使用 mysql 8驱动吗?
- 昨天阿里学长写了一个责任链模式,竟然出现了无数个bug
- Which securities company has a low, safe and reliable online account opening commission
- 任职 22 年,PowerShell 之父将从微软离职:曾因开发 PowerShell 被微软降级过
- 微信小程序视频分享平台系统毕业设计毕设(7)中期检查报告
- QT official example: QT quick controls - Gallery
- Renren potential field method
- Another double non reform exam 408, will it be cold? Software College of Nanchang Aviation University
猜你喜欢
Nm01 function overview and API definition of nm module independent of bus protocol
Babbitt | metauniverse daily must read: can you buy a virtual anchor for 1000 yuan? Is this the live gospel of small businesses or "cutting leeks"
QT official example: QT quick controls - Gallery
UE4 用spline畫正圓
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations
又一所双非改考408,会爆冷么?南昌航空大学软件学院
Redis(7)----数据库与过期键
Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01
微信小程序视频分享平台系统毕业设计毕设(3)后台功能
Redis(6)----对象与数据结构
随机推荐
在支付宝账户上买基金安全吗
Esp32-c3 introductory tutorial question ⑪ - ESP tls: create_ ssl_ handle failed, tls_ io_ instance->options. trusted_ certs null
In early summer, Kaiyuan magic changed an electric mosquito racket with killing sound effect!
如何优雅的写 Controller 层代码?
Leetcode 面试题 16.17. 连续数列
Installation tutorial and simple call of Matplotlib
UE4 draw a circle with spline
300+篇文献!一文详解基于Transformer的多模态学习最新进展
What is cloud primordial? This time, I can finally understand!
QQmlApplicationEngine
AI开发调试系列第二弹:多机分布式调测探索之旅
Win10 uninstall CUDA
快速排序基本思路(通俗易懂+例子)「建议收藏」
Wechat applet video sharing platform system graduation design completion (4) opening report
Use dosbox to run the assembly super detailed step "suggestions collection"
Wechat nucleic acid detection and appointment applet system graduation design (3) background function
一款简约PHP个人发卡程序V4.0版本
Unity学习shader笔记[八十一]简单的颜色调整后处理(亮度,饱和度,对比度)
Leetcode interview question 16.15 Abacus wonderful calculation
Unity learning shader notes [82] black and white processing of enhanced single channel color rendering