@@ -8,8 +8,7 @@ align="right">
88[ ![ Test] [ gh-actions-badge ]] [ gh-actions-url ]
99
1010The Tarantool Operator provides automation that simplifies the administration
11- of [ Tarantool Cartridge] ( https://github.com/tarantool/cartridge ) -based clusters
12- on Kubernetes.
11+ of [ Tarantool Cartridge] ( https://github.com/tarantool/cartridge ) -based cluster on Kubernetes.
1312
1413The Operator introduces new API version ` tarantool.io/v1alpha1 ` and installs
1514custom resources for objects of three custom types: Cluster, Role, and
@@ -47,71 +46,61 @@ will be removed.
4746
4847## Deploying the Tarantool operator on minikube
4948
50- 1 . Install the required software :
49+ 1 . Install the required deployment utilities :
5150
52- - [ kubectl] ( https://kubernetes.io/docs/tasks/tools/install-kubectl )
51+ * [ kubectl] ( https://kubernetes.io/docs/tasks/tools/install-kubectl )
52+ * [ helm] ( https://helm.sh/docs/intro/install/ )
5353
54- - [ minikube] ( https://kubernetes.io/docs/tasks/tools/install-minikube/ )
54+ Pick one of these to run a local kubernetes cluster
55+ * [ minikube] ( https://kubernetes.io/docs/tasks/tools/install-minikube/ )
56+ * [ Windows Docker Desktop] ( https://docs.docker.com/docker-for-windows/#kubernetes )
57+ * [ OSX Docker Desktop] ( https://docs.docker.com/docker-for-mac/#kubernetes )
5558
56- 1 . Create a ` minikube ` cluster :
59+ To install and configure a local minikube installation :
5760
58- ``` shell
59- minikube start --memory=4096
60- ```
61+ 1 . Create a ` minikube ` cluster:
6162
62- You will need 4Gb of RAM allocated to the ` minikube` cluster to run examples.
63+ ``` shell
64+ minikube start --memory=4096
65+ ```
6366
64- Ensure ` minikube` is up and running:
67+ You will need 4Gb of RAM allocated to the ` minikube` cluster to run examples.
6568
66- ` ` ` shell
67- minikube status
68- ` ` `
69+ Ensure ` minikube` is up and running:
6970
70- In case of success you will see this output:
71+ ` ` ` shell
72+ minikube status
73+ ` ` `
7174
72- ` ` ` shell
73- host: Running
74- kubelet: Running
75- apiserver: Running
76- ` ` `
75+ In case of success you will see this output:
7776
78- 1. Enable Ingress add-on:
77+ ` ` ` shell
78+ host: Running
79+ kubelet: Running
80+ apiserver: Running
81+ ` ` `
7982
80- ` ` ` shell
81- minikube addons enable ingress
82- ` ` `
83+ 2. Enable minikube Ingress add-on:
8384
84- 1. Create operator resources:
85+ ` ` ` shell
86+ minikube addons enable ingress
87+ ` ` `
8588
86- ` ` ` shell
87- kubectl create -f deploy/service_account.yaml
88- kubectl create -f deploy/role.yaml
89- kubectl create -f deploy/role_binding.yaml
90- ` ` `
91-
92- 1. Create Tarantool Operator CRD' s (Custom Resource Definitions):
93-
94- ```shell
95- kubectl create -f deploy/crds/tarantool_v1alpha1_cluster_crd.yaml
96- kubectl create -f deploy/crds/tarantool_v1alpha1_role_crd.yaml
97- kubectl create -f deploy/crds/tarantool_v1alpha1_replicasettemplate_crd.yaml
98- ```
99-
100- 1. Start the operator:
89+ 2. Install the operator
10190
10291 ` ` ` shell
103- kubectl create -f deploy/operator.yaml
92+ helm install tarantool-operator ci/helm-chart --namespace tarantool --create-namespace
10493 ` ` `
10594
10695 Ensure the operator is up:
10796
10897 ` ` ` shell
109- kubectl get pods --watch
98+ watch kubectl get pods -n tarantool
11099 ` ` `
111100
112101 Wait for ` tarantool-operator-xxxxxx-xx` Pod' s status to become `Running`.
113102
114- # # Example: key-value storage
103+ ## Example Application : key-value storage
115104
116105`examples/kv` contains a Tarantool-based distributed key-value storage.
117106Data are accessed via HTTP REST API.
@@ -128,19 +117,19 @@ Tarantool Operator is up and running.
1281171. Create a cluster:
129118
130119 ```shell
131- kubectl create -f examples/kv/deployment.yaml
120+ helm install examples-kv-cluster examples/kv/helm-chart --namespace tarantool
132121 ```
133122
134- Wait until all the cluster Pods are up (status becomes ` Running` ):
123+ Wait until all the cluster Pods are up (status becomes `Running`):
135124
136- ` ` ` shell
137- kubectl get pods --watch
138- ` ` `
125+ ```shell
126+ watch kubectl -n tarantool get pods
127+ ```
139128
140- 1. Ensure cluster became operational:
129+ 2. Ensure cluster became operational:
141130
142131 ```shell
143- kubectl describe clusters.tarantool.io examples-kv-cluster
132+ kubectl -n tarantool describe clusters.tarantool.io examples-kv-cluster
144133 ```
145134
146135 wait until Status.State is Ready:
@@ -152,25 +141,35 @@ Tarantool Operator is up and running.
152141 ...
153142 ```
154143
155- 1 . Access the cluster web UI:
144+ 3 . Access the cluster web UI:
156145
157- 1. Get ` minikube ` vm IP-address :
146+ * If using minikube :
158147
159- ` ` ` shell
160- minikube ip
161- ` ` `
148+ * Get `minikube` vm IP-address:
149+
150+ ```shell
151+ minikube ip
152+ ```
153+
154+ * Open **http://MINIKUBE_IP** in your browser.
155+ Replace MINIKUBE_IP with the IP-address reported by the previous command.
162156
163- 1. Open ** http://MINIKUBE_IP** in your browser.
164- Replace MINIKUBE_IP with the IP-address reported by the previous command.
157+ 
165158
166- ! [Web UI](./assets/kv_web_ui.png)
159+ > **_NOTE:_** Due to a recent
160+ > [bug in Ingress](https://github.com/kubernetes/minikube/issues/2840),
161+ > web UI may be inaccessible. If needed, you can try this
162+ > [workaround](https://github.com/kubernetes/minikube/issues/2840#issuecomment-492454708).
167163
168- > ** _NOTE:_** Due to a recent
169- > [bug in Ingress](https://github.com/kubernetes/minikube/issues/2840),
170- > web UI may be inaccessible. If needed, you can try this
171- > [workaround](https://github.com/kubernetes/minikube/issues/2840#issuecomment-492454708).
164+ * If using kubernetes in docker-desktop
172165
173- 1. Access the key-value API:
166+ Run: (MINIKUBE_IP will be localhost:8081 in this case)
167+
168+ ```shell
169+ kc port-forward -n tarantool routers-0-0 8081:8081
170+ ````
171+
172+ 4. Access the key-value API:
174173
175174 1. Store some value:
176175
@@ -184,7 +183,7 @@ Tarantool Operator is up and running.
184183 {"info":"Successfully created"}
185184 ```
186185
187- 1 . Access stored values:
186+ 2 . Access stored values:
188187
189188 ```shell
190189 curl http://MINIKUBE_IP/kv_dump
@@ -200,53 +199,58 @@ Tarantool Operator is up and running.
200199
2012001. Increase the number of replica sets in Storages Role:
202201
203- ` ` ` shell
204- kubectl edit roles.tarantool.io storage
202+ in the examples-kv helm chart, edit the `examples/kv/helm-chart/values.yaml` file to be
203+
204+ ```yaml
205+ - RoleName: storage
206+ ReplicaCount: 1
207+ ReplicaSetCount: 2
205208 ```
206209
207- This will open the resource in a text editor.
208- Change ` spec.numReplicasets` field value to 3:
210+ Then run:
209211
210212 ```shell
211- spec:
212- numReplicasets: 3
213+ helm upgrade examples-kv-cluster examples/kv/helm-chart --namespace tarantool
213214 ```
214215
215- Save your changes and exit the editor .
216+ This will add another storage role replica set to the existing cluster. View the new cluster topology via the cluster web UI .
216217
217- This will add new replica sets to the existing cluster.
218+ 2. Increase the number of replicas across all Storages Role replica sets:
218219
219- View the new cluster topology via the cluster web UI.
220+ in the examples-kv helm chart, edit the `examples/kv/helm-chart/values.yaml` file to be
220221
221- 1. Increase the number of replicas across all Storages Role replica sets:
222-
223- ` ` ` shell
224- kubectl edit replicasettemplates.tarantool.io storage-template
222+ ```yaml
223+ - RoleName: storage
224+ ReplicaCount: 2
225+ ReplicaSetCount: 2
225226 ```
226227
227- This will open the resource in a text editor.
228- Change ` spec.replicas` field value to 3:
228+ Then run:
229229
230230 ```shell
231- spec:
232- replicas: 3
231+ helm upgrade examples-kv-cluster examples/kv/helm-chart --namespace tarantool
233232 ```
234233
235- Save your changes and exit the editor.
234+ This will add one more replica to each Storages Role replica set. View the new cluster topology via the cluster web UI.
235+
236+ ## Development
237+
238+ ### Regenerate the Custom Resource Definitions
236239
237- This will add one more replica to each Storages Role replica set.
240+ ```shell
241+ make crds
242+ ```
238243
239- View the new cluster topology via the cluster web UI.
244+ ### Building tarantool-operator docker image
240245
241- > ** _NOTE:_** When ` kubectl` 1.16 is out, you will be able to scale the
242- > application with a single ` kubectl scale` command, for example
243- > ` kubectl scale roles.tarantool.io storage --replicas=3` .
244- > With younger versions of ` kubectl` this is impossible due to
245- > [this bug](https://github.com/kubernetes/kubernetes/issues/80515).
246+ ```shell
247+ make docker
248+ ```
246249
247250### Running tests
248251
249252```shell
253+ # In the examples/kv directory
250254make build
251255make start
252256./bootstrap.sh
0 commit comments