Skip to content

Commit 29a5119

Browse files
committed
updated stolonctl doc
Clarify some of the options and the wording. fix argurments typo
1 parent 3403866 commit 29a5119

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

doc/stolonctl.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
11
## Stolon Client (stolonctl)
22

3-
`stolonctl` is the stolon client which controls the stolon cluster(s)
3+
`stolonctl` is the stolon client which controls the stolon cluster(s).
44

5-
It needs to communicate with the cluster store (providing `--store-backend` and related option) on which the requested cluster name (`--cluster-name`) is running.
5+
Since `stolonctl`needs to communicate with the cluster backend store, it requires providing the requested cluster name (`--cluster-name`), its store backend type (`--store-backend`), and how to reach the store, such as:
6+
* For etcdv2, etcdv3 or consul as store, a comma separated list of endpoints (`--store--endpoints`).
7+
* For kubernetes as store, the kind of kubernetes resources (`--kube-resource-kind`). See below.
68

7-
To avoid repeating for every command (or inside scripts) all the options you can export them as environment variables. Their name will be the same as the option name converted in uppercase, with `_` replacing `-` and prefixed with `STOLONCTL_`.
9+
`stolonctl` example for checking the status of a cluster named "stolon-cluster" using "etcdv3" as a store backend:
10+
```
11+
$ stolonctl --cluster-name=stolon-cluster --store-backend=etcdv3 --store-endpoints=http://etcd-0:2379,http://etcd-1:2379,http://etcd-2:2379 status
12+
```
13+
14+
Note: To avoid repeating the arguments on every command (or inside scripts), all the options can be exported as environment variables. Their name will be the same as the option name converted in uppercase, with `_` replacing `-` and prefixed with `STOLONCTL_`.
815

9-
Ex.
16+
For example:
1017
```
1118
STOLONCTL_STORE_BACKEND
1219
STOLONCTL_STORE_ENDPOINTS
1320
STOLONCTL_CLUSTER_NAME
1421
```
1522

23+
### Running in Kubernetes
24+
25+
`stolonctl` behaves like [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) when choosing how to access the kubernetes API server(s):
26+
* When run inside a pod it uses the pod service account to connect to the k8s API servers.
27+
* When run externally it honors the $KUBECONFIG environment variable to connect. It is thus possible to use the default `~/.kube/config` file or an overriden kube-config file path, context and namespace to set the `stolonctl` options `--kubeconfig`, `--kube-context` and `--kube-namespace`.
28+
29+
`stolonctl` example for checking the status of a cluster named "kube-stolon" using "kubernetes" as a store backend and "configmap" as the resource kind where the `stolonctl` command is invoked via one of the stolon proxy pods:
30+
```
31+
$kubectl exec -i -t stolon-proxy-669f7b54fd-9psm2 -- stolonctl --cluster-name=kube-stolon --store-backend=kubernetes --kube-resource-kind=configmap status
32+
```
33+
34+
Same `stolonctl` command as a one shot:
35+
```
36+
kubectl run -i -t stolonctl --image=sorintlab/stolon:master-pg9.6 --restart=Never --rm -- /usr/local/bin/stolonctl --cluster-name=kube-stolon --store-backend=kubernetes --kube-resource-kind=configmap status
37+
```
38+
1639
### See also
1740

1841
[stolonctl command invocation](commands/stolonctl.md)

0 commit comments

Comments
 (0)