Creating Kubernetes cluster templates

POST /v1/clustertemplates

Create a new Kubernetes cluster template. After this, you can create Kubernetes clusters based on this template.

Use the template to specify network information. In addition, enable load balancing with master_lb_enabled for clusters with multiple masters and nodes. Some of the parameters (labels, flavor IDs, and such) can be specified either in a template or a cluster itself.

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

Request

Parameters

Name In Type Description
floating_ip_enabled 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.
fixed_subnet (Optional) body string Fixed subnet that are using to allocate network address for nodes in bay/cluster.
master_flavor_id (Optional) body string The flavor of the master node for this baymodel/cluster template.
no_proxy (Optional) body string When a proxy server is used, some sites should not go through the proxy and should be accessed normally. In this case, users can specify these sites as a comma separated list of IPs. The default is None.
https_proxy (Optional) body string The IP address for a proxy to use when direct HTTPS access from the servers to sites on the external internet is blocked. This may happen in certain countries or enterprises, and the proxy allows the servers and containers to access these sites. The format is a URL including a port number. The default is None.
tls_disabled body boolean Transport Layer Security (TLS) is normally enabled to secure the bay/cluster. In some cases, users may want to disable TLS in the bay/cluster, for instance during development or to troubleshoot certain problems. Specifying this parameter will disable TLS so that users can access the COE endpoints without a certificate. The default is TLS enabled.
keypair_id 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.
public body boolean Access to a baymodel/cluster template is normally limited to the admin, owner or users within the same tenant as the owners. Setting this flag makes the baymodel/cluster template public and accessible by other users. The default is not public.
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.
docker_volume_size body integer The size in GB for the local storage on each server for the Docker daemon to cache the images and host the containers. Cinder volumes provide the storage. The default is 25 GB. For the devicemapper storage driver, the minimum value is 3 GB. For the overlay storage driver, the minimum value is 1 GB.
server_type body string The servers in the bay/cluster can be vm or baremetal. This parameter selects the type of server to create for the bay/cluster. The default is vm.
external_network_id body string The name or network ID of a Neutron network to provide connectivity to the external internet for the bay/cluster. This network must be an external network, i.e. its attribute router:external must be True. The servers in the bay/cluster will be connected to a private network and Magnum will create a router between this private network and the external network. This will allow the servers to download images, access discovery service, etc, and the containers to install packages, etc. In the opposite direction, floating IPs will be allocated from the external network to provide access from the external internet to servers and the container services hosted in the bay/cluster.
image_id body string The name or UUID of the base image in Glance to boot the servers for the bay/cluster. The image must have the attribute os_distro defined as appropriate for the bay/cluster driver.
volume_driver body string The name of a volume driver for managing the persistent storage for the containers. The functionality supported are specific to the driver.
registry_enabled (Optional) body boolean Docker images by default are pulled from the public Docker registry, but in some cases, users may want to use a private registry. This option provides an alternative registry based on the Registry V2: Magnum will create a local registry in the bay/cluster backed by swift to host the images. The default is to use the public registry.
docker_storage_driver body string The name of a driver to manage the storage for the images and the container’s writable layer. The default is devicemapper.
name body string Name of the resource.
network_driver body string The name of a network driver for providing the networks for the containers. Note that this is different and separate from the Neutron network for the bay/cluster. The operation and networking model are specific to the particular driver.
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.
coe body string Specify the Container Orchestration Engine to use. Supported COEs include kubernetes, swarm, mesos. If your environment has additional bay/cluster drivers installed, refer to the bay/cluster driver documentation for the new COE names.
flavor_id body string The nova flavor ID or name for booting the node servers. The default is m1.small.
master_lb_enabled body boolean Since multiple masters may exist in a bay/cluster, a Neutron load balancer is created to provide the API endpoint for the bay/cluster and to direct requests to the masters. In some cases, such as when the LBaaS service is not available, this option can be set to false to create a bay/cluster without the load balancer. In this case, one of the masters will serve as the API endpoint. The default is true, i.e. to create the load balancer for the bay.
dns_nameserver body string The DNS nameserver for the servers and containers in the bay/cluster to use. This is configured in the private Neutron network for the bay/cluster. The default is 8.8.8.8.
hidden (Optional) body boolean Indicates whether the ClusterTemplate is hidden or not, the default value is false.

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_template",
  "server_type": "vm",
  "cluster_distro": "fedora-atomic",
  "image_id": "f1e62c6a-37d8-4e73-9729-ad957e509c11",
  "volume_driver": "cinder",
  "docker_storage_driver": "devicemapper",
  "docker_volume_size": "10",
  "network_driver": "flannel",
  "coe": "kubernetes",
  "master_lb_enabled": true,
  "floating_ip_enabled": true,
  "fixed_network": "666d0a98-9de7-45df-9301-5ed12a7efea1",
  "fixed_subnet": "43b25f61-657c-407f-935c-3a456aab7943",
  "external_network_id": "7cc2fa27-b387-4a67-8b89-94b608295623",
  "labels": {
    "kube_tag": "v1.15.6",
    "cloud_provider_enabled": "true",
    "cloud_provider_tag": "v1.15.0",
    "kube_version": "v1.15.6",
    "boot_volume_type": "default",
    "flannel_tag": "v0.11.0-amd64",
    "boot_volume_size": "10",
    "heat_container_agent_tag": "hci-3.5-latest",
    "docker_volume_type": "default"
  }
}' https://<node_IP_addr>:9513/v1/clustertemplates

Response

Parameters

Name In Type Description
insecure_registry body string The URL pointing to users’s own private insecure docker registry to deploy and run docker containers.
links body array Links to the resources in question.
updated_at body string

The date and time when the resource was updated. If the resource has not been updated, this field will be null.

The date and time stamp format is ISO 8601:

CCYY-MM-DDThh:mm:ss±hh:mm

For example, 2015-08-27T09:49:58-05:00.

The ±hh:mm value, if included, is the time zone as an offset from UTC. In this example, the offset value is -05:00.

floating_ip_enabled 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.
fixed_subnet (Optional) body string Fixed subnet that are using to allocate network address for nodes in bay/cluster.
master_flavor_id (Optional) body string The flavor of the master node for this baymodel/cluster template.
uuid body UUID The UUID of the cluster template.
no_proxy (Optional) body string When a proxy server is used, some sites should not go through the proxy and should be accessed normally. In this case, users can specify these sites as a comma separated list of IPs. The default is None.
https_proxy (Optional) body string The IP address for a proxy to use when direct HTTPS access from the servers to sites on the external internet is blocked. This may happen in certain countries or enterprises, and the proxy allows the servers and containers to access these sites. The format is a URL including a port number. The default is None.
tls_disabled body boolean Transport Layer Security (TLS) is normally enabled to secure the bay/cluster. In some cases, users may want to disable TLS in the bay/cluster, for instance during development or to troubleshoot certain problems. Specifying this parameter will disable TLS so that users can access the COE endpoints without a certificate. The default is TLS enabled.
keypair_id 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.
public body boolean Access to a baymodel/cluster template is normally limited to the admin, owner or users within the same tenant as the owners. Setting this flag makes the baymodel/cluster template public and accessible by other users. The default is not public.
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.
docker_volume_size body integer The size in GB for the local storage on each server for the Docker daemon to cache the images and host the containers. Cinder volumes provide the storage. The default is 25 GB. For the devicemapper storage driver, the minimum value is 3 GB. For the overlay storage driver, the minimum value is 1 GB.
server_type body string The servers in the bay/cluster can be vm or baremetal. This parameter selects the type of server to create for the bay/cluster. The default is vm.
external_network_id body string The name or network ID of a Neutron network to provide connectivity to the external internet for the bay/cluster. This network must be an external network, i.e. its attribute router:external must be True. The servers in the bay/cluster will be connected to a private network and Magnum will create a router between this private network and the external network. This will allow the servers to download images, access discovery service, etc, and the containers to install packages, etc. In the opposite direction, floating IPs will be allocated from the external network to provide access from the external internet to servers and the container services hosted in the bay/cluster.
cluster_distro body string Display the attribute os_distro defined as appropriate metadata in image for the bay/cluster driver.
image_id body string The name or UUID of the base image in Glance to boot the servers for the bay/cluster. The image must have the attribute os_distro defined as appropriate for the bay/cluster driver.
volume_driver body string The name of a volume driver for managing the persistent storage for the containers. The functionality supported are specific to the driver.
registry_enabled (Optional) body boolean Docker images by default are pulled from the public Docker registry, but in some cases, users may want to use a private registry. This option provides an alternative registry based on the Registry V2: Magnum will create a local registry in the bay/cluster backed by swift to host the images. The default is to use the public registry.
docker_storage_driver body string The name of a driver to manage the storage for the images and the container’s writable layer. The default is devicemapper.
apiserver_port body integer The exposed port of COE API server.
name body string Name of the resource.
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, 2015-08-27T09:49:58-05:00.

The ±hh:mm value, if included, is the time zone as an offset from UTC. In this example, the offset value is -05:00.

network_driver body string The name of a network driver for providing the networks for the containers. Note that this is different and separate from the Neutron network for the bay/cluster. The operation and networking model are specific to the particular driver.
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.
coe body string Specify the Container Orchestration Engine to use. Supported COEs include kubernetes, swarm, mesos. If your environment has additional bay/cluster drivers installed, refer to the bay/cluster driver documentation for the new COE names.
flavor_id body string The nova flavor ID or name for booting the node servers. The default is m1.small.
master_lb_enabled body boolean Since multiple masters may exist in a bay/cluster, a Neutron load balancer is created to provide the API endpoint for the bay/cluster and to direct requests to the masters. In some cases, such as when the LBaaS service is not available, this option can be set to false to create a bay/cluster without the load balancer. In this case, one of the masters will serve as the API endpoint. The default is true, i.e. to create the load balancer for the bay.
dns_nameserver body string The DNS nameserver for the servers and containers in the bay/cluster to use. This is configured in the private Neutron network for the bay/cluster. The default is 8.8.8.8.
hidden (Optional) body boolean Indicates whether the ClusterTemplate is hidden or not, the default value is false.

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.

Example

{
  "insecure_registry": null,
  "links": [
    {
      "href": "https://<node_IP_addr>:9513/v1/clustertemplates/b5093d08-f9fd-4a7c-8f69-8cfeb3710e4e",
      "rel": "self"
    },
    {
      "href": "https://<node_IP_addr>:9513/clustertemplates/b5093d08-f9fd-4a7c-8f69-8cfeb3710e4e",
      "rel": "bookmark"
    }
  ],
  "http_proxy": null,
  "updated_at": null,
  "floating_ip_enabled": true,
  "fixed_subnet": "43b25f61-657c-407f-935c-3a456aab7943",
  "master_flavor_id": null,
  "user_id": "2a55cfc7747b4383b0856a0a622914dd",
  "uuid": "b5093d08-f9fd-4a7c-8f69-8cfeb3710e4e",
  "no_proxy": null,
  "https_proxy": null,
  "tls_disabled": false,
  "keypair_id": null,
  "hidden": false,
  "project_id": "888ea5e76b284d83a18b3bfaa6fdde16",
  "public": false,
  "labels": {
    "cloud_provider_enabled": "true",
    "kube_tag": "v1.15.6",
    "heat_container_agent_tag": "hci-3.5-latest",
    "kube_version": "v1.15.6",
    "boot_volume_type": "default",
    "flannel_tag": "v0.11.0-amd64",
    "boot_volume_size": "10",
    "cloud_provider_tag": "v1.15.0",
    "docker_volume_type": "default"
  },
  "docker_volume_size": 10,
  "server_type": "vm",
  "external_network_id": "7cc2fa27-b387-4a67-8b89-94b608295623",
  "cluster_distro": "fedora-atomic",
  "image_id": "f1e62c6a-37d8-4e73-9729-ad957e509c11",
  "volume_driver": "cinder",
  "registry_enabled": false,
  "docker_storage_driver": "devicemapper",
  "apiserver_port": null,
  "name": "kub1_template",
  "created_at": "2020-04-14T13:26:01+00:00",
  "network_driver": "flannel",
  "fixed_network": "666d0a98-9de7-45df-9301-5ed12a7efea1",
  "coe": "kubernetes",
  "flavor_id": null,
  "master_lb_enabled": true,
  "dns_nameserver": null
}