代码之家  ›  专栏  ›  技术社区  ›  Sudhir

通过REST API创建K8S机密时出错

  •  0
  • Sudhir  · 技术社区  · 6 年前

    下面是脚本,我正在运行,但在分析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
    

    错误:

    “reason”:“badrequest”,

    1 回复  |  直到 6 年前
        1
  •  0
  •   Sudhir    6 年前

    curl -vk \ -X POST \ -d @- \ -H "Authorization: Bearer $(cat token)" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ https://192.168.2.100:6443/api/v1/namespaces/nginx-ingress/secrets <<'EOF' { "apiVersion":"v1", "kind" :"Secret", "metadata" :{"namespace" :"nginx-ingress","name":"mysecret1"}, "type": "Opaque", "data": {"username": "YWRtaW4=","password": "MWYyZDFlMmU2N2Rm"} }

    推荐文章