mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 05:02:50 +00:00
update example/rethinkdb to v1beta3
add external load balancer to work on GCE add a comment about nodeSelector in gen-pod.sh update the image/run.sh to v1beta3
This commit is contained in:
@@ -10,6 +10,12 @@ Setting up a [rethinkdb](http://rethinkdb.com/) cluster on [kubernetes](http://k
|
||||
|
||||
Quick start
|
||||
-----------
|
||||
**Step 0**
|
||||
|
||||
change the namespace of the current context to "rethinkdb"
|
||||
```
|
||||
$kubectl config view -o template --template='{{index . "current-context"}}' | xargs -I {} kubectl config set-context {} --namespace=rethinkdb
|
||||
```
|
||||
|
||||
**Step 1**
|
||||
|
||||
@@ -17,15 +23,15 @@ antmanler/rethinkdb will discover peer using endpoints provided by kubernetes_ro
|
||||
so first create a service so the following pod can query its endpoint
|
||||
|
||||
```shell
|
||||
kubectl create -f driver-service.yaml
|
||||
$kubectl create -f driver-service.yaml
|
||||
```
|
||||
|
||||
check out:
|
||||
|
||||
```shell
|
||||
$kubectl get se
|
||||
NAME LABELS SELECTOR IP PORT
|
||||
rethinkdb-driver db=influxdb db=rethinkdb 10.241.105.47 28015
|
||||
NAME LABELS SELECTOR IP(S) PORT(S)
|
||||
rethinkdb-driver db=influxdb db=rethinkdb 10.0.27.114 28015/TCP
|
||||
```
|
||||
|
||||
**Step 2**
|
||||
@@ -33,7 +39,7 @@ rethinkdb-driver db=influxdb db=rethinkdb 10.241.105.47
|
||||
start fist server in cluster
|
||||
|
||||
```shell
|
||||
kubectl create -f rc.yaml
|
||||
$kubectl create -f rc.yaml
|
||||
```
|
||||
|
||||
Actually, you can start servers as many as you want at one time, just modify the `replicas` in `rc.ymal`
|
||||
@@ -42,8 +48,9 @@ check out again:
|
||||
|
||||
```shell
|
||||
$kubectl get po
|
||||
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS
|
||||
99f6d361-abd6-11e4-a1ea-001c426dbc28 10.240.2.68 rethinkdb rethinkdb:1.16.0 10.245.2.2/ db=rethinkdb,role=replicas Running
|
||||
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE
|
||||
rethinkdb-rc-1.16.0-6odi0 kubernetes-minion-s59e/ db=rethinkdb,role=replicas Pending 11 seconds
|
||||
rethinkdb antmanler/rethinkdb:1.16.0
|
||||
```
|
||||
|
||||
**Done!**
|
||||
@@ -61,10 +68,13 @@ You can scale up you cluster using `kubectl resize`, and new pod will join to ex
|
||||
$kubectl resize rc rethinkdb-rc-1.16.0 --replicas=3
|
||||
resized
|
||||
$kubectl get po
|
||||
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS
|
||||
99f6d361-abd6-11e4-a1ea-001c426dbc28 10.240.2.68 rethinkdb rethinkdb:1.16.0 10.245.2.2/ db=rethinkdb,role=replicas Running
|
||||
d10182b5-abd6-11e4-a1ea-001c426dbc28 10.240.26.14 rethinkdb rethinkdb:1.16.0 10.245.2.4/ db=rethinkdb,role=replicas Running
|
||||
d101c1a4-abd6-11e4-a1ea-001c426dbc28 10.240.11.14 rethinkdb rethinkdb:1.16.0 10.245.2.3/ db=rethinkdb,role=replicas Running
|
||||
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE
|
||||
rethinkdb-rc-1.16.0-6odi0 10.244.3.3 kubernetes-minion-s59e/104.197.79.42 db=rethinkdb,role=replicas Running About a minute
|
||||
rethinkdb antmanler/rethinkdb:1.16.0 Running About a minute
|
||||
rethinkdb-rc-1.16.0-e3mxv kubernetes-minion-d7ub/ db=rethinkdb,role=replicas Pending 6 seconds
|
||||
rethinkdb antmanler/rethinkdb:1.16.0
|
||||
rethinkdb-rc-1.16.0-manu6 kubernetes-minion-cybz/ db=rethinkdb,role=replicas Pending 6 seconds
|
||||
rethinkdb antmanler/rethinkdb:1.16.0
|
||||
```
|
||||
|
||||
Admin
|
||||
@@ -81,12 +91,28 @@ find the service
|
||||
|
||||
```shell
|
||||
$kubectl get se
|
||||
NAME LABELS SELECTOR IP PORT
|
||||
rethinkdb-admin db=influxdb db=rethinkdb,role=admin 10.241.220.209 8080
|
||||
rethinkdb-driver db=influxdb db=rethinkdb 10.241.105.47 28015
|
||||
NAME LABELS SELECTOR IP(S) PORT(S)
|
||||
rethinkdb-admin db=influxdb db=rethinkdb,role=admin 10.0.131.19 8080/TCP
|
||||
104.197.19.120
|
||||
rethinkdb-driver db=influxdb db=rethinkdb 10.0.27.114 28015/TCP
|
||||
```
|
||||
|
||||
open a web browser and access to *http://10.241.220.209:8080* to manage you cluster
|
||||
We request for an external load balancer in the admin-service.yaml file:
|
||||
|
||||
```
|
||||
createExternalLoadBalancer: true
|
||||
```
|
||||
|
||||
The external load balancer allows us to access the service from outside via an external IP, which is 104.197.19.120 in this case.
|
||||
|
||||
Note that you may need to create a firewall rule to allow the traffic, assuming you are using GCE:
|
||||
```
|
||||
$ gcloud compute firewall-rules create rethinkdb --allow=tcp:8080
|
||||
```
|
||||
|
||||
Now you can open a web browser and access to *http://104.197.19.120:8080* to manage your cluster.
|
||||
|
||||
|
||||
|
||||
**Why not just using pods in replicas?**
|
||||
|
||||
@@ -101,6 +127,6 @@ since the ui is not stateless when playing with Web Admin UI will cause `Connect
|
||||
* All services and pods are placed under namespace `rethinkdb`.
|
||||
|
||||
* `gen_pod.sh` is using to generate pod templates for my local cluster,
|
||||
the generated pods which is using `nodeSelector` to force k8s to schedule containers to my designate nodes, for I need to access persistent data on my host dirs.
|
||||
the generated pods which is using `nodeSelector` to force k8s to schedule containers to my designate nodes, for I need to access persistent data on my host dirs. Note that one needs to label the node before 'nodeSelector' can work, see this [tutorial](https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/node-selection)
|
||||
|
||||
* see [antmanler/rethinkdb-k8s](https://github.com/antmanler/rethinkdb-k8s) for detail
|
||||
|
Reference in New Issue
Block a user