Openstack 万能团簇生成

Openstack 万能团簇生成,openstack,Openstack,根据我创建集群所需的全部信息,传递如下参数: curl --header "X-Auth-Token: blah" \ -X POST https://myopenstack:9511/v1/clusters -d name="Swarm-cluster-ansible" -d cluster_template_id="7402f9d3-4881-440f-8496-08d420935f58" -d node_count=2 -d keypair="k8s-gitlab-ci" 它给了我:

根据我创建集群所需的全部信息,传递如下参数:

 curl --header "X-Auth-Token: blah" \
 -X POST https://myopenstack:9511/v1/clusters -d name="Swarm-cluster-ansible" -d cluster_template_id="7402f9d3-4881-440f-8496-08d420935f58" -d node_count=2 -d keypair="k8s-gitlab-ci"
它给了我:

{"errors": [{"status": 400, "code": "client", "links": [], "title": "Unknown argument: \"cluster_template_id, node_count, keypair, name\"", "detail": "Unknown argument: \"cluster_template_id, node_count, keypair, name\"", "request_id": ""}]}
如果我这样做:

curl --header "X-Auth-Token: blah" \
 -X POST https://myopenstack:9511/v1/clusters -d cluster='{
   "name":"swarm",
   "master_count":1,
   "discovery_url":null,
   "cluster_template_id":"7402f9d3-4881-440f-8496-08d420935f58",
   "node_count":1,
   "keypair":"k8s-gitlab-ci",
   "master_flavor_id":null,
   "labels":{
   },
   "flavor_id":null
}'


{"errors": [{"status": 400, "code": "client", "links": [], "title": "Invalid input for field/attribute cluster", "detail": "Invalid input for field/attribute cluster. Value: '{\n   \"name\":\"swarm\",\n   \"master_count\":1,\n   \"discovery_url\":null,\n   \"cluster_template_id\":\"7402f9d3-4881-440f-8496-08d420935f58\",\n   \"node_count\":1,\n   \"keypair\":\"k8s-gitlab-ci\",\n   \"master_flavor_id\":null,\n   \"labels\":{\n   },\n   \"flavor_id\":null\n}'. unable to convert to Cluster. Error: __init__() takes exactly 1 argument (2 given)", "request_id": ""}]}
有什么想法吗


编辑:我能够获取和检索现有集群的列表。

-H“内容类型:应用程序/json”
在这种情况下就足够了,因此正文被解释为JSON。

在请求中,当您以JSON格式传递请求正文时,需要将
内容类型:application/JSON
作为参数放入
curl
命令中。