当前位置:网站首页>故障排查: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 。
边栏推荐
- Web chat tool
- After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
- Installation tutorial and simple call of Matplotlib
- 深度神经网络总结
- 链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
- Wechat applet video sharing platform system graduation design (2) applet function
- Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
- C语言中函数参数传递的三种方式
- UE4 用spline画正圆
- Wechat nucleic acid detection appointment applet system graduation design completion (1) development outline
猜你喜欢

Qt Official examples: Qt Quick Controls - Gallery

27:第三章:开发通行证服务:10:【注册/登录】接口:注册/登录OK后,把用户会话信息(uid,utoken)保存到redis和cookie中;(一个主要的点:设置cookie)

Another double non reform exam 408, will it be cold? Software College of Nanchang Aviation University

ESP32-C3入门教程 问题篇⑩——error: implicit declaration of function ‘esp_blufi_close‘;

Wechat applet video sharing platform system graduation design (3) background function

Chrome officially supports MathML, which is enabled in chromium dev 105 by default

工业软件讲堂-三维CAD设计软件的核心技术解析----讲坛第二次讲座

Wechat applet video sharing platform system graduation design completion (6) opening defense ppt

一款简约PHP个人发卡程序V4.0版本

Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
随机推荐
Qt官方示例:Qt Quick Controls - Gallery
工业软件讲堂-三维CAD设计软件的核心技术解析----讲坛第二次讲座
Please, stop painting star! This has nothing to do with patriotism!
Wechat applet video sharing platform system graduation design completion (8) graduation design thesis template
【Oracle 期末复习】表空间、表、约束、索引、视图的增删改
如何设置VSCode删除整行快捷键?
“栈”的典型应用—表达式求值(C语言实现)
Concepts and differences of PR curve and ROC curve
深度神经网络总结
微信小程序视频分享平台系统毕业设计毕设(4)开题报告
Leetcode interview question 17.01 Addition without plus sign
【愚公系列】2022年07月 Go教学课程 001-Go语言前提简介
RDK仿真实验
微信核酸检测预约小程序系统毕业设计毕设(2)小程序功能
消除IBM P750小机上的黄色报警灯[通俗易懂]
300+篇文献!一文详解基于Transformer的多模态学习最新进展
Architecture design - ID generator "suggestions collection"
Detailed explanation of cjson usage
MySQL about only_ full_ group_ By limit
国金证券是国企吗?在国金证券开户资金安全吗?
