@@ -6,8 +6,7 @@ align="right">
66# Tarantool Kubernetes operator
77
88The Tarantool Operator provides automation that simplifies the administration
9- of [ Tarantool Cartridge] ( https://github.com/tarantool/cartridge ) -based clusters
10- on Kubernetes.
9+ of [ Tarantool Cartridge] ( https://github.com/tarantool/cartridge ) -based cluster on Kubernetes.
1110
1211The Operator introduces new API version ` tarantool.io/v1alpha1 ` and installs
1312custom resources for objects of three custom types: Cluster, Role, and
@@ -45,71 +44,61 @@ will be removed.
4544
4645## Deploying the Tarantool operator on minikube
4746
48- 1 . Install the required software :
47+ 1 . Install the required deployment utilities :
4948
50- - [ kubectl] ( https://kubernetes.io/docs/tasks/tools/install-kubectl )
49+ * [ kubectl] ( https://kubernetes.io/docs/tasks/tools/install-kubectl )
50+ * [ helm] ( https://helm.sh/docs/intro/install/ )
5151
52- - [ minikube] ( https://kubernetes.io/docs/tasks/tools/install-minikube/ )
52+ Pick one of these to run a local kubernetes cluster
53+ * [ minikube] ( https://kubernetes.io/docs/tasks/tools/install-minikube/ )
54+ * [ Windows Docker Desktop] ( https://docs.docker.com/docker-for-windows/#kubernetes )
55+ * [ OSX Docker Desktop] ( https://docs.docker.com/docker-for-mac/#kubernetes )
5356
54- 1 . Create a ` minikube ` cluster :
57+ To install and configure a local minikube installation :
5558
56- ``` shell
57- minikube start --memory=4096
58- ```
59+ 1 . Create a ` minikube ` cluster:
5960
60- You will need 4Gb of RAM allocated to the ` minikube` cluster to run examples.
61+ ``` shell
62+ minikube start --memory=4096
63+ ```
6164
62- Ensure ` minikube` is up and running:
65+ You will need 4Gb of RAM allocated to the ` minikube` cluster to run examples.
6366
64- ` ` ` shell
65- minikube status
66- ` ` `
67+ Ensure ` minikube` is up and running:
6768
68- In case of success you will see this output:
69+ ` ` ` shell
70+ minikube status
71+ ` ` `
6972
70- ` ` ` shell
71- host: Running
72- kubelet: Running
73- apiserver: Running
74- ` ` `
73+ In case of success you will see this output:
7574
76- 1. Enable Ingress add-on:
75+ ` ` ` shell
76+ host: Running
77+ kubelet: Running
78+ apiserver: Running
79+ ` ` `
7780
78- ` ` ` shell
79- minikube addons enable ingress
80- ` ` `
81+ 2. Enable minikube Ingress add-on:
8182
82- 1. Create operator resources:
83-
84- ` ` ` shell
85- kubectl create -f deploy/service_account.yaml
86- kubectl create -f deploy/role.yaml
87- kubectl create -f deploy/role_binding.yaml
88- ` ` `
89-
90- 1. Create Tarantool Operator CRD' s (Custom Resource Definitions):
91-
92- ```shell
93- kubectl create -f deploy/crds/tarantool_v1alpha1_cluster_crd.yaml
94- kubectl create -f deploy/crds/tarantool_v1alpha1_role_crd.yaml
95- kubectl create -f deploy/crds/tarantool_v1alpha1_replicasettemplate_crd.yaml
96- ```
83+ ` ` ` shell
84+ minikube addons enable ingress
85+ ` ` `
9786
98- 1. Start the operator:
87+ 2. Install the operator
9988
10089 ` ` ` shell
101- kubectl create -f deploy/operator.yaml
90+ helm install tarantool-operator ci/helm-chart --namespace tarantool --create-namespace
10291 ` ` `
10392
10493 Ensure the operator is up:
10594
10695 ` ` ` shell
107- kubectl get pods --watch
96+ watch kubectl get pods -n tarantool
10897 ` ` `
10998
11099 Wait for ` tarantool-operator-xxxxxx-xx` Pod' s status to become `Running`.
111100
112- # # Example: key-value storage
101+ ## Example Application : key-value storage
113102
114103`examples/kv` contains a Tarantool-based distributed key-value storage.
115104Data are accessed via HTTP REST API.
@@ -126,19 +115,19 @@ Tarantool Operator is up and running.
1261151. Create a cluster:
127116
128117 ```shell
129- kubectl create -f examples/kv/deployment.yaml
118+ helm install examples-kv-cluster examples/kv/helm-chart --namespace tarantool
130119 ```
131120
132- Wait until all the cluster Pods are up (status becomes ` Running` ):
121+ Wait until all the cluster Pods are up (status becomes `Running`):
133122
134- ` ` ` shell
135- kubectl get pods --watch
136- ` ` `
123+ ```shell
124+ watch kubectl -n tarantool get pods
125+ ```
137126
138- 1. Ensure cluster became operational:
127+ 2. Ensure cluster became operational:
139128
140129 ```shell
141- kubectl describe clusters.tarantool.io examples-kv-cluster
130+ kubectl -n tarantool describe clusters.tarantool.io examples-kv-cluster
142131 ```
143132
144133 wait until Status.State is Ready:
@@ -150,25 +139,35 @@ Tarantool Operator is up and running.
150139 ...
151140 ```
152141
153- 1 . Access the cluster web UI:
142+ 3 . Access the cluster web UI:
154143
155- 1. Get ` minikube ` vm IP-address :
144+ * If using minikube :
156145
157- ` ` ` shell
158- minikube ip
159- ` ` `
146+ * Get `minikube` vm IP-address:
147+
148+ ```shell
149+ minikube ip
150+ ```
151+
152+ * Open **http://MINIKUBE_IP** in your browser.
153+ Replace MINIKUBE_IP with the IP-address reported by the previous command.
154+
155+ 
156+
157+ > **_NOTE:_** Due to a recent
158+ > [bug in Ingress](https://github.com/kubernetes/minikube/issues/2840),
159+ > web UI may be inaccessible. If needed, you can try this
160+ > [workaround](https://github.com/kubernetes/minikube/issues/2840#issuecomment-492454708).
160161
161- 1. Open ** http://MINIKUBE_IP** in your browser.
162- Replace MINIKUBE_IP with the IP-address reported by the previous command.
162+ * If using kubernetes in docker-desktop
163163
164- ! [Web UI](./assets/kv_web_ui.png )
164+ Run: (MINIKUBE_IP will be localhost:8081 in this case )
165165
166- > ** _NOTE:_** Due to a recent
167- > [bug in Ingress](https://github.com/kubernetes/minikube/issues/2840),
168- > web UI may be inaccessible. If needed, you can try this
169- > [workaround](https://github.com/kubernetes/minikube/issues/2840#issuecomment-492454708).
166+ ```shell
167+ kc port-forward -n tarantool routers-0-0 8081:8081
168+ ````
170169
171- 1 . Access the key-value API:
170+ 4 . Access the key-value API:
172171
173172 1. Store some value:
174173
@@ -182,7 +181,7 @@ Tarantool Operator is up and running.
182181 {"info":"Successfully created"}
183182 ```
184183
185- 1 . Access stored values:
184+ 2 . Access stored values:
186185
187186 ```shell
188187 curl http://MINIKUBE_IP/kv_dump
@@ -198,49 +197,45 @@ Tarantool Operator is up and running.
198197
1991981. Increase the number of replica sets in Storages Role:
200199
201- ` ` ` shell
202- kubectl edit roles.tarantool.io storage
200+ in the examples-kv helm chart, edit the `examples/kv/helm-chart/values.yaml` file to be
201+
202+ ```yaml
203+ - RoleName: storage
204+ ReplicaCount: 1
205+ ReplicaSetCount: 2
203206 ```
204207
205- This will open the resource in a text editor.
206- Change ` spec.numReplicasets` field value to 3:
208+ Then run:
207209
208210 ```shell
209- spec:
210- numReplicasets: 3
211+ helm upgrade examples-kv-cluster examples/kv/helm-chart --namespace tarantool
211212 ```
212213
213- Save your changes and exit the editor .
214+ This will add another storage role replica set to the existing cluster. View the new cluster topology via the cluster web UI .
214215
215- This will add new replica sets to the existing cluster.
216+ 2. Increase the number of replicas across all Storages Role replica sets:
216217
217- View the new cluster topology via the cluster web UI.
218+ in the examples-kv helm chart, edit the `examples/kv/helm-chart/values.yaml` file to be
218219
219- 1. Increase the number of replicas across all Storages Role replica sets:
220-
221- ` ` ` shell
222- kubectl edit replicasettemplates.tarantool.io storage-template
220+ ```yaml
221+ - RoleName: storage
222+ ReplicaCount: 2
223+ ReplicaSetCount: 2
223224 ```
224225
225- This will open the resource in a text editor.
226- Change ` spec.replicas` field value to 3:
226+ Then run:
227227
228228 ```shell
229- spec:
230- replicas: 3
229+ helm upgrade examples-kv-cluster examples/kv/helm-chart --namespace tarantool
231230 ```
232231
233- Save your changes and exit the editor .
232+ This will add one more replica to each Storages Role replica set. View the new cluster topology via the cluster web UI .
234233
235- This will add one more replica to each Storages Role replica set.
234+ ### Building tarantool-operator docker image
236235
237- View the new cluster topology via the cluster web UI.
238-
239- > ** _NOTE:_** When ` kubectl` 1.16 is out, you will be able to scale the
240- > application with a single ` kubectl scale` command, for example
241- > ` kubectl scale roles.tarantool.io storage --replicas=3` .
242- > With younger versions of ` kubectl` this is impossible due to
243- > [this bug](https://github.com/kubernetes/kubernetes/issues/80515).
236+ ```shell
237+ docker build -f build/Dockerfile -t tarantool-operator .
238+ ```
244239
245240### Running tests
246241
0 commit comments