зеркало из https://github.com/github/vitess-gh.git
Add Kubernetes config for vtctld.
This commit is contained in:
Родитель
559e598458
Коммит
fb4a75378b
|
@ -6,7 +6,7 @@ appropriate [Getting Started Guide](https://github.com/GoogleCloudPlatform/kuber
|
|||
to get Kubernetes up and running if you haven't already. We currently test
|
||||
against HEAD, so you may want to build Kubernetes from the latest source.
|
||||
|
||||
## ZooKeeper
|
||||
## Starting ZooKeeper
|
||||
|
||||
Once you have a running Kubernetes deployment, make sure
|
||||
*kubernetes/cluster/kubecfg.sh* is in your path, and then run:
|
||||
|
@ -43,3 +43,49 @@ To tear down the ZooKeeper deployment (again, with *kubecfg.sh* in your path):
|
|||
```
|
||||
vitess$ examples/kubernetes/zk-down.sh
|
||||
```
|
||||
|
||||
## Starting vtctld
|
||||
|
||||
The vtctld server provides a web interface to inspect the state of the system,
|
||||
and also accepts RPC commands to modify the system.
|
||||
|
||||
```
|
||||
vitess/examples/kubernetes$ kubecfg.sh -c vtctld-pod.yaml create pods
|
||||
vitess/examples/kubernetes$ kubecfg.sh -c vtctld-service.yaml create services
|
||||
```
|
||||
|
||||
To access vtctld from your workstation, open up port 15000 to any minion in your
|
||||
firewall. Then get the external address of that minion and visit http://<minion-addr>:15000/.
|
||||
|
||||
## Issuing commands with vtctlclient
|
||||
|
||||
If you've opened port 15000 on your minion's firewall, you can run *vtctlclient*
|
||||
locally to issue commands:
|
||||
|
||||
```
|
||||
# check the connection to vtctld, and list available commands
|
||||
$ sudo docker run -ti --rm vitess/root vtctlclient -server <minion-addr>:15000
|
||||
|
||||
# create a global keyspace record
|
||||
$ sudo docker run -ti --rm vitess/root vtctlclient -server <minion-addr>:15000 CreateKeyspace my_keyspace
|
||||
```
|
||||
|
||||
If you don't want to open the port on the firewall, you can SSH into one of your
|
||||
minions and perform the above commands against the minion's local Kubernetes proxy.
|
||||
For example:
|
||||
|
||||
```
|
||||
# log in to a minion
|
||||
$ gcloud compute ssh kubernetes-minion-1
|
||||
|
||||
# run a command
|
||||
kubernetes-minion-1:~$ sudo docker run -ti --rm vitess/root vtctlclient -server $HOSTNAME:15000 CreateKeyspace your_keyspace
|
||||
```
|
||||
|
||||
## Creating a keyspace and shard
|
||||
|
||||
```
|
||||
$ alias vtctl="sudo docker run -ti --rm vitess/root vtctlclient -server <minion-addr>:15000"
|
||||
$ vtctl CreateKeyspace test_keyspace
|
||||
$ vtctl CreateShard test_keyspace/0
|
||||
```
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
apiVersion: v1beta1
|
||||
kind: Pod
|
||||
id: vtctld
|
||||
desiredState:
|
||||
manifest:
|
||||
version: v1beta1
|
||||
id: vtctld
|
||||
containers:
|
||||
- name: vtctld
|
||||
image: vitess/root
|
||||
volumeMounts:
|
||||
- name: syslog
|
||||
mountPath: /dev/log
|
||||
- name: vtdataroot
|
||||
mountPath: /vt/vtdataroot
|
||||
command:
|
||||
- sh
|
||||
- "-c"
|
||||
- >-
|
||||
echo "{\"test_cell\":\"$SERVICE_HOST:2181\",\"global\":\"$SERVICE_HOST:2181\"}" > /vt/zk-client-conf.json &&
|
||||
chown vitess /vt/* &&
|
||||
su -p -c "/vt/bin/vtctld -debug -templates $VTTOP/go/cmd/vtctld/templates -log_dir $VTDATAROOT/tmp -port 15000" vitess
|
||||
env:
|
||||
- name: ZK_CLIENT_CONFIG
|
||||
value: /vt/zk-client-conf.json
|
||||
volumes:
|
||||
- name: syslog
|
||||
source: {hostDir: {path: /dev/log}}
|
||||
- name: vtdataroot
|
||||
source: {emptyDir: {}}
|
||||
labels:
|
||||
name: vtctld
|
|
@ -0,0 +1,9 @@
|
|||
apiVersion: v1beta1
|
||||
kind: Service
|
||||
id: vtctld
|
||||
port: 15000
|
||||
containerPort: 15000
|
||||
selector:
|
||||
name: vtctld
|
||||
labels:
|
||||
name: vtctld
|
Загрузка…
Ссылка в новой задаче