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.

Install kubectl plugin

  • 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

Use kubectl plugin to retrieve data

Sample command to use kubectl plugin:

USAGE:
    kubectl-mayastor [OPTIONS] <SUBCOMMAND>

OPTIONS:
    -h, --help
            Print help information
    -j, --jaeger <JAEGER>
            Trace rest requests to the Jaeger endpoint agent
    -k, --kube-config-path <KUBE_CONFIG_PATH>
            Path to kubeconfig file
    -n, --namespace <NAMESPACE>
            Kubernetes namespace of mayastor service, defaults to mayastor [default: mayastor]
    -o, --output <OUTPUT>
            The Output, viz yaml, json [default: none]
    -r, --rest <REST>
            The rest endpoint to connect to
    -t, --timeout <TIMEOUT>
            Timeout for the REST operations [default: 10s]
    -V, --version
            Print version information
SUBCOMMANDS:
    cordon      'Cordon' resources
    drain       'Drain' resources
    dump        `Dump` resources
    get         'Get' resources
    help        Print this message or the help of the given subcommand(s)
    scale       'Scale' resources
    uncordon    'Uncordon' resources

You can use the plugin with the following options:

Get Mayastor Volumes

kubectl mayastor get volumes

Get Mayastor Pools

kubectl mayastor get pools

Get Mayastor 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>

Scale the replica count of a volume

kubectl mayastor scale volume <volume_id> <size>

Retrieve resource in any of the output formats (table, JSON or YAML)

Table is the default output format.

kubectl mayastor -ojson get <resource_type>

Retrieve 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.

List available volume snapshots

kubectl mayastor get volume-snapshots

Limitations of kubectl plugin

  • The plugin currently does not have authentication support.

  • The plugin can operate only over HTTP.

Learn more

Last updated