3.17. Managing Kubernetes Clusters

3.17.1. vinfra service compute k8saas create

Create a new Kubernetes cluster:

usage: vinfra service compute k8saas create [--master-node-count <count>]
                                            [--node-count <count>]
                                            [--volume-storage-policy <policy>]
                                            [--kubernetes-version <version>]
                                            --master-flavor <flavor> --flavor
                                            <flavor> [--volume-size <size>]
                                            --external-network <network>
                                            [--network <network>] --key-name
                                            <key-name>
                                            [--use-floating-ip <use-floating-ip>]
                                            <name>
<name>
Kubernetes cluster name
--master-node-count <count>
The amount of master nodes in the Kubernetes cluster
--node-count <count>
The amount of worker nodes in the Kubernetes cluster
--volume-storage-policy <policy>
The ID or name of the storage policy for the volume where containers will reside.
--kubernetes-version <version>
Kubernetes version
--master-flavor <flavor>
The flavor to use for Kubernetes master nodes.
--flavor <flavor>
The flavor to use for Kubernetes worker nodes.
--volume-size <size>
The size of the storage volume on each Kubernetes node
--external-network <network>
The ID or name of a public network that will provide Internet access to Kubernetes nodes.
--network <netwlork>
The ID or name of a private network that will provide networking between Kubernetes nodes.
--key-name <key-name>
The key pair to use for accessing the Kubernetes nodes.
--use-floating-ip <use-floating-ip>
Assign floating IP addresses to master and worker nodes (‘true’ or ‘false’).

The prerequisites for creating a Kubernetes cluster are:

  • The Kubernetes-as-a-service component. It can be deployed along with the compute cluster or later (see Creating the Compute Cluster or Managing Add-On Services).
  • A private network that will interconnect Kubernetes nodes. It needs to have a gateway and a DNS server specified.
  • A public network with Internet access (for reaching the etcd discovery service) and the traffic types Compute API and VM public assigned to it.
  • An SSH key that will be installed on both the master and worker nodes.
  • Enough resources for all of the Kubernetes nodes, taking their flavors into account.

Example:

# vinfra service compute k8saas create --master-node-count 1 --node-count 3 \
--volume-storage-policy default --kubernetes-version v1.15.6 --master-flavor medium \
--flavor small --volume-size 10 --external-network public1 --network private1 \
--key-name key1 --use-floating-ip true k8s1 --vinfra-username user1 \
--vinfra-password password --vinfra-domain domain1 --vinfra-project project1

+----------------------------------+--------------------------------------+
| Field                            | Value                                |
+----------------------------------+--------------------------------------+
| boot_volume_size                 | 10                                   |
| boot_volume_storage_policy       | default                              |
| containers_volume_size           | 10                                   |
| containers_volume_storage_policy | default                              |
| create_timeout                   | 60                                   |
| external_network_id              | 7006065f-9067-4aed-b888-d89baa7004b8 |
| id                               | c0754d99-6066-4675-8062-e62602939cf3 |
| key_name                         | key1                                 |
| master_flavor                    | medium                               |
| master_node_count                | 1                                    |
| name                             | k8s1                                 |
| network_id                       | d037623b-0db7-40c2-b38a-9ac34fbd1cc5 |
| project_id                       | c734b9832e9540bd8f79bc2272c167e6     |
| status                           | CREATING                             |
| user_id                          | c2cba773dc824125b07720744d0e49e2     |
| worker_pools                     | - flavor: small                      |
|                                  |   node_count: 3                      |
+----------------------------------+--------------------------------------+

This command, run as user1 from domain1 > project1, starts creation of the Kubernetes cluster k8s1 with these parameters:

  • Kubernetes version 1.15.6
  • 1 master node based on the medium flavor and 3 worker nodes based on the small flavor
  • 10 GB storage volumes covered by the default storage policy
  • private network private1 that will connect to the Internet via the public network public1
  • floating IP addresses for each node picked from the specified public network
  • public SSH key key1

3.17.2. vinfra service compute k8saas list

List Kubernetes clusters:

usage: vinfra service compute k8saas list

Example:

# vinfra service compute k8saas list
+--------------------------------------+------+--------+
| id                                   | name | status |
+--------------------------------------+------+--------+
| f3e71ee8-8583-4b6a-abce-0132818f5108 | k8s1 | ACTIVE |
+--------------------------------------+------+--------+

This command displays the list of Kubernetes clusters.

3.17.3. vinfra service compute k8saas config

Print Kubernetes cluster configuration (must be run as the user who created the Kubernetes cluster):

usage: vinfra service compute k8saas config <cluster>
cluster
Cluster ID or name

Example:

# vinfra service compute k8saas config k8s1 --vinfra-domain domain1 \
--vinfra-project project1 --vinfra-username user1 --vinfra-password password \
> kubeconfig

This command prints the configuration of the Kubernetes cluster k8s1 to the file kubeconfig.

3.17.4. vinfra service compute k8saas show

Display Kubernetes cluster details:

usage: vinfra service compute k8saas show <cluster>
cluster
Cluster ID or name

Example:

# vinfra service compute k8saas show k8s1
+----------------------------------+--------------------------------------+
| Field                            | Value                                |
+----------------------------------+--------------------------------------+
| boot_volume_size                 | 10                                   |
| boot_volume_storage_policy       | default                              |
| containers_volume_size           | 10                                   |
| containers_volume_storage_policy | default                              |
| create_timeout                   | 60                                   |
| external_network_id              | 7006065f-9067-4aed-b888-d89baa7004b8 |
| id                               | c0754d99-6066-4675-8062-e62602939cf3 |
| key_name                         | key1                                 |
| master_flavor                    | medium                               |
| master_node_count                | 1                                    |
| name                             | k8s1                                 |
| network_id                       | d037623b-0db7-40c2-b38a-9ac34fbd1cc5 |
| project_id                       | c734b9832e9540bd8f79bc2272c167e6     |
| stack_id                         | 3ef9ec9d-fde4-4358-bdb6-91205cd8ca52 |
| status                           | ACTIVE                               |
| user_id                          | c2cba773dc824125b07720744d0e49e2     |
| version                          | v1.15.6                              |
| worker_pools                     | - flavor: small                      |
|                                  |   node_count: 3                      |
+----------------------------------+--------------------------------------+

This command displays the details of the Kubernetes cluster k8s1.

3.17.5. vinfra service compute k8saas set

Modify Kubernetes cluster parameters (must be run as the user who created the Kubernetes cluster):

usage: vinfra service compute k8saas set [--node-count <count>]
                                         [--volume-storage-policy <policy>]
                                         <cluster>
cluster
Cluster ID or name
--node-count <count>
The amount of worker nodes in the Kubernetes cluster
--volume-storage-policy <policy>
The ID or name of the storage policy for the volume where containers will reside.

Example:

# vinfra service compute k8saas set --node-count 5 k8s1 \
--vinfra-domain domain1 --vinfra-project project1 \
--vinfra-username user1 --vinfra-password password
+----------------------------------+--------------------------------------+
| Field                            | Value                                |
+----------------------------------+--------------------------------------+
| boot_volume_size                 | 10                                   |
| boot_volume_storage_policy       | default                              |
| containers_volume_size           | 10                                   |
| containers_volume_storage_policy | default                              |
| create_timeout                   | 60                                   |
| external_network_id              | 7006065f-9067-4aed-b888-d89baa7004b8 |
| id                               | c0754d99-6066-4675-8062-e62602939cf3 |
| key_name                         | key1                                 |
| master_flavor                    | medium                               |
| master_node_count                | 1                                    |
| name                             | k8s1                                 |
| network_id                       | d037623b-0db7-40c2-b38a-9ac34fbd1cc5 |
| project_id                       | c734b9832e9540bd8f79bc2272c167e6     |
| stack_id                         | 3ef9ec9d-fde4-4358-bdb6-91205cd8ca52 |
| status                           | ACTIVE                               |
| user_id                          | c2cba773dc824125b07720744d0e49e2     |
| version                          | v1.15.6                              |
| worker_pools                     | - flavor: small                      |
|                                  |   node_count: 3                      |
+----------------------------------+--------------------------------------+

This command starts configuring the Kubernetes cluster k8s1 to bring the number of worker nodes to 5.

3.17.6. vinfra service compute k8saas delete

Delete a Kubernetes cluster:

usage: vinfra service compute k8saas delete <cluster>
cluster
Cluster ID or name

Example:

# vinfra service compute k8saas delete k8s1
Operation accepted.

This command deletes the Kubernetes cluster k8s1.