Kubernetes ConfigMap 创建失败 cannot unmarshal number into Go struct field ConfigMap.data of type string
Kubernetes YAML About 368 words错误信息
ConfigMap in version "v1" cannot be handled as a ConfigMap: json: cannot unmarshal number into Go struct field ConfigMap.data of type string
ConfigMap yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: myconfigmap
data:
username: zhangsan
password: 123
原因
上述案例中的password
填写的是123
,Go
语言在转换时认为了是一个number
类型的变量,所以转换失败。
解决方法
对于纯数字类型的变量,可以添加双引号,即password: "123"
。
Views: 4,912 · Posted: 2022-11-09
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...