Creating Kubernetes clusters

POST /v1/clusters

Create a new Kubernetes cluster based on a cluster template. Refer to Creating Kubernetes cluster templates for more information.

Source: https://docs.openstack.org/api-ref/container-infrastructure-management/?expanded=create-new-cluster-detail#create-new-cluster

Request

Parameters

Name In Type Description
name body string Name of the resource.
discovery_url body string

The custom discovery URL for node discovery. This is used by the COE to discover the servers that have been created to host the containers. The actual discovery mechanism varies with the COE. In some cases, Magnum fills in the server info in the discovery service. In other cases, if the discovery_url is not specified, Magnum will use the public discovery service at:

https://discovery.etcd.io

In this case, Magnum will generate a unique URL here for each bay and store the info for the servers.

master_count body integer The number of servers that will serve as master for the bay/cluster. The default is 1. Set to more than 1 master to enable High Availability. If the option master-lb-enabled is specified in the baymodel/cluster template, the master servers will be placed in a load balancer pool.
cluster_template_id body UUID The UUID of the cluster template.
node_count body integer The number of servers that will serve as node in the bay/cluster. The default is 1.
keypair body string The name of the SSH keypair to configure in the bay/cluster servers for ssh access. Users will need the key to be able to ssh to the servers in the bay/cluster. The login name is specific to the bay/cluster driver, for example with fedora-atomic image, default login name is fedora.
create_timeout body integer The timeout for cluster creation in minutes. The value expected is a positive integer and the default is 60 minutes. If the timeout is reached during cluster creation process, the operation will be aborted and the cluster status will be set to CREATE_FAILED.
master_flavor_id (Optional) body string The flavor of the master node for this baymodel/cluster template.
labels (Optional) body array Arbitrary labels in the form of key=value pairs. The accepted keys and valid values are defined in the bay/cluster drivers. They are used as a way to pass additional parameters that are specific to a bay/cluster driver.
flavor_id body string The nova flavor ID or name for booting the node servers. The default is m1.small.
fixed_subnet (Optional) body string Fixed subnet that are using to allocate network address for nodes in bay/cluster.
fixed_network (Optional) body string The name or network ID of a Neutron network to provide connectivity to the internal network for the bay/cluster.
floating_ip_enabled (Optional) body boolean Whether enable or not using the floating IP of cloud provider. Some cloud providers used floating IP, some used public IP, thus Magnum provide this option for specifying the choice of using floating IP. If it’s not set, the value of floating_ip_enabled in template will be used.

Example

# curl -ks -X POST -H 'Content-Type: application/json' -H 'OpenStack-API-Version: container-infra 1.8' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
  "name": "kub1",
  "master_count": 2,
  "master_flavor_id": "medium",
  "node_count": 2,
  "flavor_id": "small",
  "keypair": "key1",
  "docker_volume_size": 10,
  "cluster_template_id": "b5093d08-f9fd-4a7c-8f69-8cfeb3710e4e",
  "create_timeout": 60
}' https://<node_IP_addr>:9513/v1/clusters

Response

Parameters

Name In Type Description
uuid body UUID The UUID of the cluster.

Status codes

Success

Code Reason
202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code Reason
400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

404 - Not Found

The requested resource could not be found.

Example

{
  "uuid": "ea9182cc-26ef-4087-bdd7-097cc99672ea"
}