Skip to content

Commit 4004d7b

Browse files
lenkisvasiliy-t
authored andcommitted
Add ingress activation + create RUS readme (#4)
* Add ingress activation + create RUS readme
1 parent 4b65b3a commit 4004d7b

File tree

4 files changed

+240
-22
lines changed

4 files changed

+240
-22
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,6 @@ tags
7474
### VisualStudioCode ###
7575
.vscode/*
7676
.history
77+
### MacOS specific ###
78+
.DS_Store
7779
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode

README.md

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ align="right">
55

66
# Tarantool Kubernetes operator
77

8-
The Tarantool Operator provides automation that simplifies the administration of [Tarantool Cartridge](https://github.com/tarantool/cartridge)-based clusters on Kubernetes.
8+
The Tarantool Operator provides automation that simplifies the administration
9+
of [Tarantool Cartridge](https://github.com/tarantool/cartridge)-based clusters
10+
on Kubernetes.
911

10-
The Operator introduces new API version `tarantool.io/v1alpha1` and installs custom resources for objects of three custom types: Cluster, Role, and ReplicasetTemplate.
12+
The Operator introduces new API version `tarantool.io/v1alpha1` and installs
13+
custom resources for objects of three custom types: Cluster, Role, and
14+
ReplicasetTemplate.
1115

1216
## Table of contents
1317

1418
* [Resources](#resources)
1519
* [Resource ownership](#resource-ownership)
1620
* [Deploying the Tarantool operator on minikube](#deploying-the-tarantool-operator-on-minikube)
17-
* [Example: key value storage](#example-key-value-storage)
18-
* [Application topology overview](#application-topology-overview)
19-
* [Running the example](#running-the-example)
20-
* [Scaling the example application](#scaling-the-example-application)
21+
* [Example: key-value storage](#example-key-value-storage)
22+
* [Application topology](#application-topology)
23+
* [Running the application](#running-the-application)
24+
* [Scaling the application](#scaling-the-application)
2125
* [Running tests](#running-tests)
2226

2327
## Resources
@@ -30,11 +34,14 @@ The Operator introduces new API version `tarantool.io/v1alpha1` and installs cus
3034

3135
## Resource ownership
3236

33-
Resources managed by the Operator being deployed have the following resource ownership hierarchy:
37+
Resources managed by the Operator being deployed have the following resource
38+
ownership hierarchy:
3439

3540
![Resource ownership](./assets/resource_map.png)
3641

37-
Resource ownership directly affects how Kubernetes garbage collector works. If you execute a delete command on a parent resource, then all its dependants will be removed.
42+
Resource ownership directly affects how Kubernetes garbage collector works.
43+
If you execute a delete command on a parent resource, then all its dependants
44+
will be removed.
3845

3946
## Deploying the Tarantool operator on minikube
4047

@@ -66,6 +73,12 @@ Resource ownership directly affects how Kubernetes garbage collector works. If y
6673
apiserver: Running
6774
```
6875

76+
1. Enable Ingress add-on:
77+
78+
```shell
79+
minikube addons enable ingress
80+
```
81+
6982
1. Create operator resources:
7083

7184
```shell
@@ -74,7 +87,7 @@ Resource ownership directly affects how Kubernetes garbage collector works. If y
7487
kubectl create -f deploy/role_binding.yaml
7588
```
7689

77-
1. Create Tarantool Operator CRD's;
90+
1. Create Tarantool Operator CRD's (Custom Resource Definitions):
7891
7992
```shell
8093
kubectl create -f deploy/crds/tarantool_v1alpha1_cluster_crd.yaml
@@ -94,43 +107,48 @@ Resource ownership directly affects how Kubernetes garbage collector works. If y
94107
kubectl get pods --watch
95108
```
96109
97-
Wait for `tarantool-operator-xxxxxx-xx` Pod's STATUS to become `Running`.
110+
Wait for `tarantool-operator-xxxxxx-xx` Pod's status to become `Running`.
98111

99-
## Example: key value storage
112+
## Example: key-value storage
100113

101-
`examples/kv` contains a Tarantool-based distributed key value storage. Data are accessed via HTTP REST API.
114+
`examples/kv` contains a Tarantool-based distributed key-value storage.
115+
Data are accessed via HTTP REST API.
102116

103-
### Application topology overview
117+
### Application topology
104118

105119
![App topology](./examples/kv/assets/topology.png)
106120

107-
### Running the example
121+
### Running the application
108122

109-
We assume that commands are executed from the repository root and Tarantool Operator is up and running.
123+
We assume that commands are executed from the repository root and
124+
Tarantool Operator is up and running.
110125

111126
1. Create a cluster:
112127

113128
```shell
114129
kubectl create -f examples/kv/deployment.yaml
115130
```
116131

117-
1. Wait until the cluster Pods are up:
132+
Wait until all the cluster Pods are up (status becomes `Running`):
118133

119134
```shell
120135
kubectl get pods --watch
121136
```
122137

123138
1. Access the cluster web UI:
124139

125-
1. Get `minikube` vm ip-address:
140+
1. Get `minikube` vm IP-address:
126141

127142
```shell
128143
minikube ip
129144
```
130145

131-
1. Navigate to **http://MINIKUBE_IP** with your browser. Replace MINIKUBE_IP with the IP-address reported by the previous command.
146+
1. Open **http://MINIKUBE_IP** in your browser.
147+
Replace MINIKUBE_IP with the IP-address reported by the previous command.
148+
149+
![Web UI](./assets/kv_web_ui.png)
132150

133-
1. Access KV API:
151+
1. Access the key-value API:
134152

135153
1. Store some value:
136154

@@ -144,15 +162,15 @@ We assume that commands are executed from the repository root and Tarantool Oper
144162
curl http://MINIKUBE_IP/kv_dump
145163
```
146164

147-
### Scaling the example application
165+
### Scaling the application
148166

149167
1. Increase the number of replica sets in Storages Role:
150168

151169
```shell
152170
kubectl scale roles.tarantool.io storage --replicas=3
153171
```
154172

155-
This will add one or more replica sets to the existing cluster.
173+
This will add new replica sets to the existing cluster.
156174

157175
View the new cluster topology via the cluster web UI.
158176

@@ -162,7 +180,8 @@ We assume that commands are executed from the repository root and Tarantool Oper
162180
kubectl edit replicasettemplates.tarantool.io storage-template
163181
```
164182

165-
This will open a text editor. Change `spec.replicas` field value to 3, then save and exit the editor.
183+
This will open a text editor. Change `spec.replicas` field value to 3,
184+
then save and exit the editor.
166185

167186
This will add one more replica to each Storages Role replica set.
168187

README_RUS.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<a href="http://tarantool.org">
2+
<img src="https://avatars2.githubusercontent.com/u/2344919?v=2&s=250"
3+
align="right">
4+
</a>
5+
6+
# Tarantool Kubernetes-оператор
7+
8+
Tarantool Kubernetes-оператор -- это средство автоматизации, позволяющее
9+
упростить администрирование Tarantool-кластеров, разработанных на фреймворке
10+
[Tarantool Cartridge](https://github.com/tarantool/cartridge) и развернутых
11+
под управлением Kubernetes.
12+
13+
Kubernetes-оператор реализует API версии `tarantool.io/v1alpha1` устанавливает
14+
ресурсы для объектов трех типов: Cluster, Role и ReplicasetTemplate.
15+
16+
## Содержание
17+
18+
* [Ресурсы](#ресурсы)
19+
* [Владение ресурсами](#владение-ресурсами)
20+
* [Развертывание оператора в minikube](#развертывание-оператора-в-minikube)
21+
* [Пример: база данных типа ключ-значение](#пример-база-данных-типа-ключ-значение)
22+
* [Топология приложения](#топология-приложения)
23+
* [Запуск приложения](#запуск-приложения)
24+
* [Масштабирование приложения](#масштабирование-приложения)
25+
* [Запуск тестов](#запуск-тестов)
26+
27+
## Ресурсы
28+
29+
**Cluster** -- это кластер, разработанный с помощью Tarantool Cartridge.
30+
31+
**Role** -- это пользовательская роль, разработанная с помощью Tarantool Cartridge.
32+
33+
**ReplicasetTemplate** -- это шаблон StatefulSet-ов, которые являются членами Role.
34+
35+
## Владение ресурсами
36+
37+
Так выглядит иерархия владения у ресурсов, которыми управляет запущенный оператор:
38+
39+
![Resource ownership](./assets/resource_map.png)
40+
41+
Иерархия владения ресурсами прямым образом влияет работу сборщика мусора в Kubernetes.
42+
Если выполнить команду удаления на родительском ресурсе, то сборщик удалит и все
43+
зависимые ресурсы.
44+
45+
## Развертывание оператора в minikube
46+
47+
1. Установите необходимое ПО:
48+
49+
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl)
50+
51+
- [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)
52+
53+
1. Создайте кластер в `minikube`:
54+
55+
```shell
56+
minikube start --memory=4096
57+
```
58+
59+
Для работы кластера и приложений-примеров вам понадобится выделить 4Gb оперативной памяти.
60+
61+
Удостоверьтесь, что `minikube` успешно запущен:
62+
63+
```shell
64+
minikube status
65+
```
66+
67+
В случае успеха вывод в консоли будет выглядеть так:
68+
69+
```shell
70+
host: Running
71+
kubelet: Running
72+
apiserver: Running
73+
```
74+
75+
1. Активируйте компонент Ingress:
76+
77+
```shell
78+
minikube addons enable ingress
79+
```
80+
81+
1. Создайте ресурсы для оператора:
82+
83+
```shell
84+
kubectl create -f deploy/service_account.yaml
85+
kubectl create -f deploy/role.yaml
86+
kubectl create -f deploy/role_binding.yaml
87+
```
88+
89+
1. Создайте пользовательские описания ресурсов (CRD) для оператора:
90+
91+
```shell
92+
kubectl create -f deploy/crds/tarantool_v1alpha1_cluster_crd.yaml
93+
kubectl create -f deploy/crds/tarantool_v1alpha1_role_crd.yaml
94+
kubectl create -f deploy/crds/tarantool_v1alpha1_replicasettemplate_crd.yaml
95+
```
96+
97+
1. Запустите оператор:
98+
99+
```shell
100+
kubectl create -f deploy/operator.yaml
101+
```
102+
103+
Удостоверьтесь, что оператор успешно запущен:
104+
105+
```shell
106+
kubectl get pods --watch
107+
```
108+
109+
Дождитесь, пока Pod `tarantool-operator-xxxxxx-xx` перейдет в статус `Running`.
110+
111+
## Пример: база данных типа ключ-значение
112+
113+
В директории `examples/kv` содержится код распределенного приложения на Tarantool,
114+
которое реализует базу данных типа ключ-значение.
115+
Доступ к данным осуществляется с помощью HTTP REST API.
116+
117+
### Топология приложения
118+
119+
![App topology](./examples/kv/assets/topology.png)
120+
121+
### Запуск приложения
122+
123+
Предполагается, что все команды выполняются из корня репозитория,
124+
а Tarantool-оператор уже запущен и работает.
125+
126+
1. Создайте кластер:
127+
128+
```shell
129+
kubectl create -f examples/kv/deployment.yaml
130+
```
131+
132+
Дождитесь, пока все Pod-ы кластера перейдут в статус Running:
133+
134+
```shell
135+
kubectl get pods --watch
136+
```
137+
138+
1. Откройте веб-интерфейс администратора кластера:
139+
140+
1. Узнайте IP-адрес виртуальной машины `minikube`:
141+
142+
```shell
143+
minikube ip
144+
```
145+
146+
1. Откройте страницу **http://MINIKUBE_IP** в браузере,
147+
заменив MINIKUBE_IP на IP-адрес из вывода предыдущей команды.
148+
149+
![Web UI](./assets/kv_web_ui.png)
150+
151+
1. Выполните API-запросы к хранилищу:
152+
153+
1. Запишите в базу тестовые данные:
154+
155+
```shell
156+
curl -XPOST http://MINIKUBE_IP/kv -d '{"key":"key_1", "value": "value_1"}'
157+
```
158+
159+
1. Запросите данные из базы:
160+
161+
```shell
162+
curl http://MINIKUBE_IP/kv_dump
163+
```
164+
165+
### Масштабирование приложения
166+
167+
1. Увеличьте количество репликасетов-хранилищ:
168+
169+
```shell
170+
kubectl scale roles.tarantool.io storage --replicas=3
171+
```
172+
173+
В результате к существующему кластеру добавятся новые репликасеты.
174+
175+
Проверьте в веб-интерфейсе, что топология изменилась.
176+
177+
1. Увеличьте количество реплик внутри каждого репликасета-хранилища:
178+
179+
```shell
180+
kubectl edit replicasettemplates.tarantool.io storage-template
181+
```
182+
183+
В открывшемся текстовом редакторе поменяйте значение поля `spec.replicas`
184+
на 3, сохраните изменения и закройте редактор.
185+
186+
В результате к каждому репликасету-хранилищу добавятся новые реплики.
187+
188+
Проверьте в веб-интерфейсе, что топология изменилась.
189+
190+
### Запуск тестов
191+
192+
```shell
193+
make build
194+
make start
195+
./bootstrap.sh
196+
make test
197+
```

assets/kv_web_ui.png

128 KB
Loading

0 commit comments

Comments
 (0)