Creating load balancers
POST /v2/lbaas/loadbalancers
Create a load balancer.
If the status is PENDING_CREATE
, issue GET /v2/lbaas/loadbalancers/{loadbalancer_id}
to view the progress of
the provisioning operation. When the load balancer status changes
to ACTIVE
, the load balancer is successfully provisioned and
is ready for further configuration.
Administrative users can specify a project ID that is different than their own to create load balancers for other projects.
Request
Parameters
Name | In | Type | Description |
---|---|---|---|
loadbalancer
|
body | object | A loadbalancer object. |
admin_state_up (Optional) |
body | boolean | The administrative state of the resource, which is
up (true ) or down (false ). Default is true . |
description (Optional) |
body | string | A human-readable description for the resource. |
flavor_id (Optional) |
body | uuid | The ID of the flavor. |
listeners (Optional) |
body | array | The associated listener IDs, if any. |
name (Optional) |
body | string | Human-readable name of the resource. |
project_id (Optional) |
body | string | The ID of the project owning this resource. |
provider (Optional) |
body | string | Provider name for the load balancer. Default is octavia . |
tags (Optional) |
body | list |
A list of simple strings assigned to the resource. New in version 2.5 |
vip_address (Optional) |
body | string | The IP address of the Virtual IP (VIP). |
vip_network_id (Optional) |
body | uuid | The ID of the network for the Virtual IP (VIP). One of vip_network_id ,
vip_port_id , or vip_subnet_id must be specified. |
vip_port_id (Optional) |
body | uuid | The ID of the Virtual IP (VIP) port. One of vip_network_id ,
vip_port_id , or vip_subnet_id must be specified. |
vip_qos_policy_id (Optional) |
body | uuid | The ID of the QoS Policy which will apply to the Virtual IP (VIP). |
vip_subnet_id (Optional) |
body | uuid | The ID of the subnet for the Virtual IP (VIP). One of vip_network_id ,
vip_port_id , or vip_subnet_id must be specified. |
vip_ip_version (Optional) |
body | integer | The IP protocol version. Valid value is 4 or 6 . Default is 4 .
One of vip_network_id , vip_port_id , vip_subnet_id , or
vip_ip_version must be specified. |
Example
Create a load balancer lb2
in a private network, with a pool of two members in the same private network, with an HTTP->HTTP listener on port 80->80. Additionally, assign an existing floating IP address 10.94.129.67 to the load balancer’s private IP address 192.168.10.5 to make it reachable from a public network.
# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d ' { "loadbalancer": { "name": "lb2", "project_id": "05341a23f649427baa2fd4039b7f378f", "vip_subnet_id": "fd2de462-f93b-43a6-9b5c-254f1e690bf1", "listeners": [ { "name": "http_listener", "protocol": "HTTP", "protocol_port": 80, "default_pool": { "name": "rr_pool", "protocol": "HTTP", "default_protocol_port": 80, "lb_algorithm": "ROUND_ROBIN", "healthmonitor": { "type": "HTTP", "delay": "3", "max_retries": 2, "timeout": 1 }, "members": [ { "address": "192.168.10.245", "protocol_port": 80 }, { "address": "192.168.10.168", "protocol_port": 80 } ] } } ] } }' https://<node_IP_addr>:9888/v2/lbaas/loadbalancers
Response
Parameters
Name | In | Type | Description |
---|---|---|---|
loadbalancer
|
body | object | A loadbalancer object. |
admin_state_up
|
body | boolean | The administrative state of the resource, which is
up (true ) or down (false ). |
created_at
|
body | string |
The date and time when the resource was created. The date and time stamp format is ISO 8601: CCYY-MM-DDThh:mm:ss±hh:mm For example, The |
description
|
body | string | A human-readable description for the resource. |
flavor_id
|
body | uuid | The ID of the flavor. |
id
|
body | uuid | The ID of the load balancer. |
listeners
|
body | array | The associated listener IDs, if any. |
name
|
body | string | Human-readable name of the resource. |
operating_status
|
body | string | The operating status of the resource. |
pools
|
body | array | The associated pool IDs, if any. |
project_id
|
body | string | The ID of the project owning this resource. |
provider
|
body | string | Provider name for the load balancer. |
provisioning_status
|
body | string | The provisioning status of the resource. |
tags
|
body | list |
A list of simple strings assigned to the resource. New in version 2.5 |
updated_at
|
body | string |
The date and time when the resource was updated. If the resource has
not been updated, this field will be The date and time stamp format is ISO 8601: CCYY-MM-DDThh:mm:ss±hh:mm For example, The |
vip_address
|
body | string | The IP address of the Virtual IP (VIP). |
vip_network_id
|
body | uuid | The ID of the network for the Virtual IP (VIP). |
vip_port_id
|
body | uuid | The ID of the Virtual IP (VIP) port. |
vip_qos_policy_id
|
body | uuid | The ID of the QoS Policy which will apply to the Virtual IP (VIP). |
vip_subnet_id
|
body | uuid | The ID of the subnet for the Virtual IP (VIP). |
vip_ip_version
|
body | integer | The IP protocol version. |
Status codes
Success
Code | Reason |
---|---|
201 - Created
|
Resource was created and is ready to use. |
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. |
500 - Internal Server Error
|
Something went wrong inside the service. This should not happen usually. If it does happen, it means the server has experienced some serious problems. |
503 - Service Unavailable
|
Service is not available. This is mostly caused by service configuration errors which prevents the service from successful start up. |
Example
{ "loadbalancer": { "provider": "amphora", "flavor_id": null, "description": "", "provisioning_status": "PENDING_CREATE", "tenant_id": "05341a23f649427baa2fd4039b7f378f", "created_at": "2020-03-20T12:58:20.584488", "admin_state_up": true, "updated_at": null, "vip_qos_policy_id": null, "vip_subnet_id": "fd2de462-f93b-43a6-9b5c-254f1e690bf1", "listeners": [ { "client_ca_tls_container_ref": null, "protocol": "HTTP", "default_tls_container_ref": null, "updated_at": "2020-03-20T12:58:25.707818", "default_pool_id": "bd04cc50-0575-45cc-a965-514357a4b62d", "id": "1dc8539c-7545-4ae8-8081-3140a47b6342", "insert_headers": {}, "sni_container_refs": [], "timeout_member_connect": 5000, "client_crl_container_ref": null, "project_id": "05341a23f649427baa2fd4039b7f378f", "operating_status": "OFFLINE", "description": "", "provisioning_status": "PENDING_CREATE", "timeout_member_data": 50000, "protocol_port": 80, "tags": [], "timeout_tcp_inspect": 0, "name": "http_listener", "admin_state_up": true, "client_authentication": "NONE", "created_at": "2020-03-20T12:58:25.569526", "timeout_client_data": 50000, "connection_limit": -1, "tenant_id": "05341a23f649427baa2fd4039b7f378f", "l7policies": [] } ], "tags": [], "vip_port_id": "fb0e8e3e-2a71-420a-885c-94f6d2c2f2b7", "vip_network_id": "15f7dc0a-712c-422f-bfd3-31dc351d9026", "vip_address": "192.168.10.5", "pools": [ { "lb_algorithm": "ROUND_ROBIN", "protocol": "HTTP", "updated_at": null, "id": "bd04cc50-0575-45cc-a965-514357a4b62d", "tags": [], "project_id": "05341a23f649427baa2fd4039b7f378f", "operating_status": "OFFLINE", "tls_container_ref": null, "description": "", "provisioning_status": "PENDING_CREATE", "members": [ { "compute_server_id": null, "monitor_port": null, "project_id": "05341a23f649427baa2fd4039b7f378f", "name": "", "weight": 1, "admin_state_up": true, "subnet_id": null, "tenant_id": "05341a23f649427baa2fd4039b7f378f", "created_at": "2020-03-20T12:58:25.105009", "provisioning_status": "PENDING_CREATE", "monitor_address": null, "updated_at": null, "tags": [], "address": "192.168.10.245", "protocol_port": 80, "backup": false, "id": "2e6b7c79-6ed1-4ccb-8525-c65fca686cb2", "operating_status": "OFFLINE" }, { "compute_server_id": null, "monitor_port": null, "project_id": "05341a23f649427baa2fd4039b7f378f", "name": "", "weight": 1, "admin_state_up": true, "subnet_id": null, "tenant_id": "05341a23f649427baa2fd4039b7f378f", "created_at": "2020-03-20T12:58:25.176757", "provisioning_status": "PENDING_CREATE", "monitor_address": null, "updated_at": null, "tags": [], "address": "192.168.10.168", "protocol_port": 80, "backup": false, "id": "3d648492-f353-4854-a196-7add03229642", "operating_status": "OFFLINE" } ], "ca_tls_container_ref": null, "name": "rr_pool", "admin_state_up": true, "tenant_id": "05341a23f649427baa2fd4039b7f378f", "created_at": "2020-03-20T12:58:24.528983", "tls_enabled": false, "session_persistence": null, "default_protocol_port": 80, "listeners": [ { "id": "1dc8539c-7545-4ae8-8081-3140a47b6342" } ], "healthmonitor": null, "crl_container_ref": null } ], "project_id": "05341a23f649427baa2fd4039b7f378f", "id": "6a4e1daf-2277-43aa-bd03-1eca6dfe9df1", "operating_status": "OFFLINE", "name": "lb2" } }