我想通过 kubectl api 创建一个秘密。下面是脚本,我正在运行但在解析 yaml 文件时出错。请帮忙
curl -vk \
-X POST \
-d @- \
-H "Authorization: Bearer $(cat token)" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
https://ip:port/api/v1/namespaces/nginx-ingress/secrets <<'EOF'
{
"apiVersion": "v1",
"kind": "Secret",
"metadata": {
"namespace": "nginx-ingress",
},
"type": "Opaque"
"data": {
"username": "YWRtaW4=",
"password": "MWYyZDFlMmU2N2Rm"
}
EOF
错误:
message": "提供的对象无法识别(必须是 Secret 类型):无法获取版本/种类;json 解析错误:无效字符 '}' 正在寻找对象键字符串的开头 ({\"apiVersion\": \"v1\",\"kind\": \"S ...)", "reason": "错误的请求”,