Skip to content

Commit 2437300

Browse files
authored
Merge pull request #101 from arangodb/getting-started-docs
Adding GettingStarted page and structuring docs for website
2 parents fc89337 + f022162 commit 2437300

File tree

14 files changed

+213
-2
lines changed

14 files changed

+213
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
State: In heavy development. DO NOT USE FOR ANY PRODUCTION LIKE PURPOSE! THINGS WILL CHANGE.
66

7-
- [User manual](./docs/user/README.md)
7+
- [Getting Started](./docs/Manual/GettingStarted/kube-arangodb/README.md)
8+
- [User manual](./docs/Manual/Programs/kube-arangodb/README.md)
89
- [Design documents](./docs/design/README.md)
910

1011
## Installation of latest release
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# Start ArangoDB on Kubernetes in 5min
2+
3+
Starting an ArangoDB database (either single server or full blown cluster)
4+
on Kubernetes involves a lot of resources.
5+
6+
The servers needs to run in `Pods`, you need `Secrets` for authentication,
7+
TLS certificates and `Services` to enable communication with the database.
8+
9+
Use `kube-arangodb`, the ArangoDB Kubernetes operator to greatly simplify
10+
this process.
11+
12+
In this guide, we'll explain what the ArangoDB Kubernetes operator is,
13+
how to install it and how use it to deploy your first ArangoDB database
14+
in a Kubernetes cluster.
15+
16+
## What is `kube-arangodb`
17+
18+
`kube-arangodb` is a set of two operators that you deploy in your Kubernetes
19+
cluster to (1) manage deployments of the ArangoDB database and (2)
20+
provide `PersistenVolumes` on local storage of your nodes for optimal
21+
storage performace.
22+
23+
Note that the operator that provides `PersistentVolumes` is not needed to
24+
run ArangoDB deployments. You can also use `PersistentVolumes` provided
25+
by other controllers.
26+
27+
In this guide we'll focus on the `ArangoDeployment` operator.
28+
29+
## Installing `kube-arangodb`
30+
31+
To install `kube-arangodb` in your Kubernetes cluster, make sure
32+
you have acces to this cluster and the rights to deploy resources
33+
at cluster level.
34+
35+
For now, any recent Kubernetes cluster will do (e.g. `minikube`).
36+
37+
Then run (replace `<version>` with the version of the operator that you want to install):
38+
39+
```bash
40+
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/<version>/manifests/crd.yaml
41+
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/<version>/manifests/arango-deployment.yaml
42+
```
43+
44+
The first command installs two `CustomResourceDefinitions` in your Kubernetes cluster:
45+
46+
- `ArangoDeployment` is the resource used to deploy ArangoDB database.
47+
- `ArangoLocalStorage` is the resource used to provision `PersistentVolumes` on local storage.
48+
49+
The second command installs a `Deployment` that runs the operator that controls
50+
`ArangoDeployment` resources.
51+
52+
## Deploying your first ArangoDB database
53+
54+
The first database we're going to deploy is a single server database.
55+
56+
Create a file called `single-server.yaml` with the following content.
57+
58+
```yaml
59+
apiVersion: "database.arangodb.com/v1alpha"
60+
kind: "ArangoDeployment"
61+
metadata:
62+
name: "single-server"
63+
spec:
64+
mode: single
65+
```
66+
67+
Now insert this resource in your Kubernetes cluster using:
68+
69+
```bash
70+
kubectl apply -f single-server.yaml
71+
```
72+
73+
The `ArangoDeployment` operator in `kube-arangodb` will now inspect the
74+
resource you just deployed and start the process to run a single server database.
75+
76+
To inspect the currentl status of your deployment, run:
77+
78+
```bash
79+
kubectl describe ArangoDeployment single-server
80+
# or shorter
81+
kubectl describe arango single-server
82+
```
83+
84+
To inspect the pods created for this deployment, run:
85+
86+
```bash
87+
kubectl get pods --selector=arango_deployment=single-server
88+
```
89+
90+
The result will look similar to this:
91+
92+
```plain
93+
NAME READY STATUS RESTARTS AGE
94+
single-server-sngl-cjtdxrgl-fe06f0 1/1 Running 0 1m
95+
```
96+
97+
Once the pod reports that it is has a `Running` status and is ready,
98+
your database s available.
99+
100+
## Connecting to your database
101+
102+
The single server database you deployed in the previous chapter is now
103+
available, but only from within the Kubernetes cluster.
104+
105+
To make the database available outside your Kubernetes cluster (e.g. for browser acces)
106+
you must deploy an additional `Service`.
107+
108+
There are several possible types of `Service` to choose from.
109+
We're going to use the `NodePort` type to expose the database on port 30529 of
110+
every node of your Kubernetes cluster.
111+
112+
Create a file called `single-server-service.yaml` with the following content.
113+
114+
```yaml
115+
kind: Service
116+
apiVersion: v1
117+
metadata:
118+
name: single-server-service
119+
spec:
120+
selector:
121+
app: arangodb
122+
arango_deployment: single-server
123+
role: single
124+
type: NodePort
125+
ports:
126+
- protocol: TCP
127+
port: 8529
128+
targetPort: 8529
129+
nodePort: 30529
130+
```
131+
132+
Deploy the `Service` into your Kubernetes cluster using:
133+
134+
```bash
135+
kubectl apply -f single-server-service.yaml
136+
```
137+
138+
Now you can connect your browser to `https://<node name>:30529/`,
139+
where `<node name>` is the name or IP address of any of the nodes
140+
of your Kubernetes cluster.
141+
142+
Your browser will show a warning about an unknown certificate.
143+
Accept the certificate for now.
144+
145+
Then login using username `root` and an empty password.
146+
147+
If you want to delete your single server ArangoDB database, just run:
148+
149+
```bash
150+
kubectl delete ArangoDeployment single-server
151+
```
152+
153+
## Deploying a full blown ArangoDB cluster database
154+
155+
The deployment of a full blown cluster is very similar to deploying
156+
a single server database. The difference is in the `mode` field of
157+
the `ArangoDeployment` specification.
158+
159+
Create a file called `cluster.yaml` with the following content.
160+
161+
```yaml
162+
apiVersion: "database.arangodb.com/v1alpha"
163+
kind: "ArangoDeployment"
164+
metadata:
165+
name: "cluster"
166+
spec:
167+
mode: cluster
168+
```
169+
170+
Now insert this resource in your Kubernetes cluster using:
171+
172+
```bash
173+
kubectl apply -f cluster.yaml
174+
```
175+
176+
The same commands used in the single server deployment can be used
177+
to inspect your cluster. Just use the correct deployment name (`cluster` instead of `single-server`).
178+
179+
Connecting to your cluster requires a different `Service` since the
180+
selector now has to select your `cluster` deployment and instead
181+
of selecting all `Pods` with role `single` it will have to select
182+
all coordinator pods.
183+
184+
The service looks like this:
185+
186+
```yaml
187+
kind: Service
188+
apiVersion: v1
189+
metadata:
190+
name: cluster-service
191+
spec:
192+
selector:
193+
app: arangodb
194+
arango_deployment: cluster
195+
role: coordinator
196+
type: NodePort
197+
ports:
198+
- protocol: TCP
199+
port: 8529
200+
targetPort: 8529
201+
nodePort: 31529
202+
```
203+
204+
Note that we've choosen a different node port (31529) for this `Service`
205+
to avoid conflicts with the port used in `single-server-service`.
206+
207+
## Where to go from here
208+
209+
- [Reference manual](../../Programs/kube-arangodb/README.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)