Mayastor Kubectl Plugin

The ‘Mayastor kubectl plugin’ can be used to view and manage Mayastor resources such as nodes, pools and volumes. It is also used for operations such as scaling the replica count of volumes.

Prerequisites

  • Ensure that port 30011 is open. This port will be needed by Mayastor kubectl plugin to communicate to REST servers from outside the cluster.

The plugin requires access to the Mayastor REST server for execution. It usually obtains the correct endpoint from the kube-config file on its own. However, if the plugin is unable to access the endpoint, the master nodes's IP needs to be specified manually using the --rest or -r flag. kubectl mayastor [OPTIONS] --rest=http://:30011

Installation

  • The Mayastor kubectl plugin is available for the Linux platform. The binary for the plugin can be found here.

  • Add the downloaded Mayastor kubectl plugin under $PATH.

To verify the installation, execute:

kubectl mayastor -V

Using Mayastor kubectl plugin

USAGE:
    kubectl-mayastor [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -j, --jaeger <jaeger>      Trace rest requests to the Jaeger endpoint agent
    -o, --output <output>      The Output, viz yaml, json [default: none]  [possible values: yaml, json, none]
    -r, --rest <rest>          The rest endpoint, parsed from KUBECONFIG, if left empty 
    -t, --timeout <timeout>    Timeout for the REST operations [default: 10s]

SUBCOMMANDS:
    get      'Get' resources
    help     Prints this message or the help of the given subcommand(s)
    scale    'Scale' resources

The plugin can be used to get the following resource information:

  • Volumes

kubectl mayastor get volumes
  • Pools

kubectl mayastor get pools
  • Nodes

kubectl mayastor get nodes

All the above resource information can be retrieved for a particular resource using its ID. The command to do so is as follows: kubectl mayastor get <resource_name> <resource_id>

The Mayastor kubectl plugin can also be used for performing the following operations:

  • Scaling the replica count of a volume

kubectl mayastor scale volume <volume_id> <size>
  • Retrieving resource specs in any desired format

kubectl mayastor -ojson get <resource_type>
  • Retrieving replica topology for specific volumes.

kubectl mayastor get volume-replica-topology <volume_id>

The plugin requires access to the Mayastor REST server for execution. It gets the master node IP from the kube-config file. In case of any failure, the REST endpoint can be specified using the ‘–rest’ flag.

Limitations:

  • The plugin currently does not have authentication support.

  • The plugin can operate only over HTTP.

  • In the case of a cluster with multiple master nodes, the plugin by default picks up the first master node IP for accessing the REST service. In case the REST service is not accessible using the selected master node IP, the plugin would not be able to pick up an alternate master node IP by default.

Last updated