Chapter 4. Using the kubectl plugin

The operator package includes pre-compiled binaries for a kubectl plugin, which simplifies the management of Tungsten Clusters.

The kubectl plugin is installed automatically if you make use of the install.sh script. The steps below are only required if you choose to install the operator manually.

To install the plugin, copy the binary into an executable PATH, for example:

shell> cd /opt/continuent/software/tungsten-operator-8.0.0-10
shell> sudo cp kubectl-tungsten/kubectl-tungsten-$(uname -o | tr '[:upper:]' '[:lower:]')-$(uname -m) /usr/local/bin/kubectl-tungsten

After installation, the plugin is available by executing either kubectl tungsten or kubectl-tungsten, for example:

shell> kubectl tungsten cluster list

The following commands are available:

Table 4.1. kubectl tungsten Commands

OptionDescription
backupManage Backups
clusterManage Clusters
completionGenerate the auto-completion script for the specified shell
expertExpert Commands
helpShow help for any command, eg `kubectl tungsten help`

To access more infomation about each command, you can use the help, for example:

shell> kubectl tungsten cluster help

Table 4.2. kubectl tungsten backup Commands

OptionDescription
createCreates new backup of a cluster to external object storage
listLists available backups

Usage: kubectl tungsten backup create BACKUP_NAME [flags]

Creates a new TungstenBackup to initialize backup for supplied cluster name. Backup process is picked up by the operator and starts immediately.

Table 4.3. kubectl tungsten backup create Commands

OptionDescription
-c, --clusterName of the Tungsten cluster
-t, --timeoutTimeout in minutes (default 300)
-w, --waitWait for backup to be completed

Usage: kubectl tungsten backup list [flags]

Lists available backups.

Table 4.4. kubectl tungsten backup list Commands

OptionDescription
-c, --clusterName of the Tungsten cluster

Table 4.5. kubectl tungsten cluster Commands

OptionDescription
cctrlGet cctrl session in specified cluster
listList clusters.
proxyProxies primary MySQL instance via connector to local machine
recoverRecover cluster or specific datasource
resetReset specific datasource
switchSwitch cluster to most advanced datasource or specific datasource
trepctlRun trepctl in specified cluster

Usage: kubectl tungsten cluster cctrl CLUSTER_NAME [args] [flags]

Get cctrl shell session in specified cluster.

Table 4.6. kubectl tungsten cluster cctrl Commands

OptionDescription
-d, --dataserviceOptional dataservice name. If not given, first physical dataservice will be used.
-i, --stdinPass stdin to the manager container (default true)
-t, --ttyAllocate a TTY to stdin (default true)

Usage: kubectl tungsten cluster proxy CLUSTER_NAME [options] [LOCAL_PORT]

Proxies MySQL primary via Tungsten Connector.

Table 4.7. kubectl tungsten cluster proxy Commands

OptionDescription
--addressAddresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of these addresses are available to bind. (default [localhost])
-d, --dataserviceOptional dataservice name. If not given, first physical dataservice will be used.
--pod-running-timeoutThe length of time (eg 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running (default 1m0s)

Usage: kubectl tungsten cluster recover CLUSTER_NAME [datasource] [flags]

Attempts to recover Tungsten cluster. When passed with optional parameter [datasource], attempts to recover only that datasource.

Table 4.8. kubectl tungsten cluster recover Commands

OptionDescription
-d, --dataserviceOptional dataservice name. If not given, first physical dataservice will be used.

Usage: kubectl tungsten cluster reset CLUSTER_NAME DATASOURCE_NAME [flags]

Resets specific datasource of a Tungsten cluster.

Table 4.9. kubectl tungsten cluster reset Commands

OptionDescription
--backupOptional backup name. If not given, the latest backup will be used.
-t, --timeoutTimeout in minutes (default 300)
-w, --waitWait for reset to be completed

Usage: kubectl-tungsten cluster switch CLUSTER_NAME [datasource] [flags]

Attempts to switch primary instance of Tungsten Cluster. When passed with optional parameter [datasource], attempts to switch to that specific datasource.

Table 4.10. kubectl tungsten cluster switch Commands

OptionDescription
-d, --dataserviceOptional dataservice name. If not given, first physical dataservice will be used.

Table 4.11. kubectl tungsten completion Commands

OptionDescription
bashGenerate the autocompletion script for bash
fishGenerate the autocompletion script for fish
powershellGenerate the autocompletion script for powershell
zshGenerate the autocompletion script for zsh

Table 4.12. kubectl tungsten expert Commands

OptionDescription
mysqlExecute MySQL command in specified cluster member