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-27
shell> sudo cp kubectl-tungsten/kubectl-tungsten-$(uname -o | tr '[:upper:]' '[:lower:]')-$(uname -m) /usr/local/bin/kubectl-tungsten
kubectl tungsten [command] [sub-command] [global-flags]
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:
| Option | Description |
|---|---|
backup | Manage Backups. |
cluster | Manage Clusters. |
completion | Generate the auto-completion script for the specified shell. |
expert | Expert Commands. |
help | Show help for any command. |
To access more information about each command, you can use the help, for example:
shell> kubectl tungsten cluster help
backup command
| Option | Description |
|---|---|
create | Creates new backup of a cluster to external object storage. |
list | Lists available backups. |
backup create command
kubectl tungsten backup create BACKUP_NAME [flags]
| Option | Description |
|---|---|
--clusterAliases: -c | Name of the Tungsten cluster. |
--timeoutAliases: -t | Timeout in minutes. Default: 300 |
--waitAliases: -w | Wait for backup to be completed. |
Creates a new TungstenBackup to initialize backup for supplied cluster name. Backup process is picked up by the operator and starts immediately.
backup list commands
kubectl tungsten backup list [flags]
Lists available backups.
cluster command
| Option | Description |
|---|---|
cctrl | Get cctrl session in specified cluster. |
list | List clusters. |
proxy | Proxies primary MySQL instance via connector to local machine. |
recover | Recover cluster or specific datasource. |
reset | Reset specific datasource. |
switch | Switch cluster to most advanced datasource or specific datasource. |
trepctl | Run trepctl in specified cluster. |
cluster cctrl command
kubectl tungsten cluster cctrl CLUSTER_NAME [args] [flags]
Get cctrl shell session in specified cluster.
| Option | Description |
|---|---|
--dataserviceAliases: -d | Optional dataservice name. If not given, first physical dataservice will be used. |
--stdinAliases: -i | Pass stdin to the manager container. Default: true |
--ttyAliases: -t | Allocate a TTY to stdin. Default: true |
cluster proxy command
kubectl tungsten cluster proxy CLUSTER_NAME [options] [LOCAL_PORT]
Proxies MySQL primary via Tungsten Connector.
| Option | Description |
|---|---|
--address | Addresses 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 used. Default: localhost |
--dataserviceAliases: -d | Optional dataservice name. If not given, first physical dataservice will be used. |
--pod-running-timeout | The length of time (eg 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running. Default: 1m0s |
cluster recover command
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.
| Option | Description |
|---|---|
--dataserviceAliases: -d | Optional dataservice name. If not given, first physical dataservice will be used. Default: localhost |
cluster reset command
kubectl tungsten cluster reset CLUSTER_NAME DATASOURCE_NAME [flags]
Resets specific datasource of a Tungsten cluster.
| Option | Description |
|---|---|
--backup | Optional backup name. If not given, the latest backup will be used. |
--timeoutAliases: -t | Timeout in minutes. Default: 300 |
--waitAliases: -w | Wait for reset to be completed. |
cluster switch command
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.
| Option | Description |
|---|---|
--dataserviceAliases: -d | Optional dataservice name. If not given, first physical dataservice will be used. |
completion command
| Option | Description |
|---|---|
bash | Generate the autocompletion script for bash. |
fish | Generate the autocompletion script for fish. |
powershell | Generate the autocompletion script for powershell. |
zsh | Generate the autocompletion script for zsh. |
expert command
| Option | Description |
|---|---|
mysql | Execute MySQL command in specified cluster member. |
Global Flags
| Option | Description |
|---|---|
--add-dir-header | If true, adds the file directory to the header of the log messages. |
--alsologtostderr | Log to standard error as well as files (no effect when --logtostderr=true). |
--as | Username to impersonate for the operation. User could be a regular user or a service account in a namespace. |
--as-group | Group to impersonate for the operation, this flag can be repeated to specify multiple groups. |
--as-uid | UID to impersonate for the operation. |
--cache-dir | Default cache directory. Default: $HOME/.kube/cache |
--certificate-authority | Path to a cert file for the certificate authority. |
--client-certificate | Path to a client certificate file for TLS. |
--client-key | Path to a client key file for TLS. |
--cluster | The name of the kubeconfig cluster to use. |
--context | The name of the kubeconfig context to use. |
--disable-compression | If true, opt-out of response compression for all requests to the server. |
--insecure-skip-tls-verify | If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. |
--kubeconfig | Path to the kubeconfig file to use for CLI requests. |
--log_backtrace_at | When logging hits line file:N, emit a stack trace. Default: 0 |
--log_dir | If non-empty, write log files in this directory (no effect when --logtostderr=true). |
--log_file | If non-empty, use this log file (no effect when --logtostderr=true). |
--log_file_max_size | Defines the maximum size a log file can grow to (no effect when --logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited.Default: 1800 |
--logtostderr | Log to standard error instead of files. Default: true |
--namespaceAliases: -n | If present, the namespace scope for this CLI request. |
--one_output | If true, only write logs to their native severity level (vs also writing to each lower severity level. (no effect when --logtostderr=true). |
--request-timeout | The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. Default: 0 |
--serverAliases: -s | The address and port of the Kubernetes API server. |
--skip_headers | If true, avoid header prefixes in the log messages. |
--skip_log_headers | If true, avoid headers when opening log files (no effect when --logtostderr=true) |
--stderrthreshold | Logs at or above this threshold go to stderr when writing to files and stderr (no effect when --logtostderr=true or --alsologtostderr=true)Default: 2 |
--tls-server-name | Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used. |
--token | Bearer token for authentication to the API server. |
--user | The name of the kubeconfig user to use. |
--vAliases: -v | Number for the log level verbosity. |
--vmodule-moduleSpec | Comma-separated list of pattern=N settings for file-filtered logging. |