-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add example configs for kubernetes; resolves #327
- Loading branch information
Showing
6 changed files
with
223 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
kind: Namespace | ||
apiVersion: v1 | ||
metadata: | ||
name: cayley | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mongo | ||
namespace: cayley | ||
labels: | ||
name: mongo | ||
spec: | ||
ports: | ||
- name: mgo | ||
port: 27017 | ||
targetPort: mgo | ||
clusterIP: None | ||
selector: | ||
role: mongo | ||
--- | ||
apiVersion: apps/v1beta1 | ||
kind: StatefulSet | ||
metadata: | ||
name: mongo | ||
namespace: cayley | ||
spec: | ||
serviceName: "mongo" | ||
replicas: 3 | ||
template: | ||
metadata: | ||
namespace: cayley | ||
labels: | ||
role: mongo | ||
environment: test | ||
spec: | ||
terminationGracePeriodSeconds: 10 | ||
containers: | ||
- name: mongo | ||
image: mongo:3 | ||
command: | ||
- mongod | ||
- "--replSet" | ||
- rs0 | ||
- "--smallfiles" | ||
- "--noprealloc" | ||
ports: | ||
- name: mgo | ||
containerPort: 27017 | ||
volumeMounts: | ||
- name: mongo-pvc | ||
mountPath: /data/db | ||
- name: mongo-sidecar | ||
image: cvallance/mongo-k8s-sidecar | ||
env: | ||
- name: MONGO_SIDECAR_POD_LABELS | ||
value: "role=mongo,environment=test" | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: mongo-pvc | ||
spec: | ||
accessModes: [ "ReadWriteOnce" ] | ||
storageClassName: standard | ||
resources: | ||
requests: | ||
storage: 20Gi | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: cayley | ||
namespace: cayley | ||
spec: | ||
selector: | ||
app: cayley | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: http | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: cayley | ||
namespace: cayley | ||
spec: | ||
replicas: 1 | ||
template: | ||
metadata: | ||
namespace: cayley | ||
labels: | ||
app: cayley | ||
spec: | ||
initContainers: | ||
- name: cayley-init | ||
image: quay.io/cayleygraph/cayley:v0.7.0-alpha | ||
command: | ||
- cayley | ||
- init | ||
- -d=mongo | ||
- -a=mongo | ||
containers: | ||
- name: cayley | ||
image: quay.io/cayleygraph/cayley:v0.7.0-alpha | ||
command: | ||
- cayley | ||
- http | ||
- --init # TODO: remove once initContainers works properly | ||
- -d=mongo | ||
- -a=mongo | ||
- --host=:64210 | ||
ports: | ||
- name: http | ||
containerPort: 64210 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
kind: Namespace | ||
apiVersion: v1 | ||
metadata: | ||
name: cayley | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: cayley | ||
namespace: cayley | ||
spec: | ||
selector: | ||
app: cayley | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: http | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: cayley-pvc | ||
namespace: cayley | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 20Gi | ||
storageClassName: standard | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: cayley | ||
namespace: cayley | ||
spec: | ||
replicas: 1 # cannot be really scaled because of local backend | ||
template: | ||
metadata: | ||
namespace: cayley | ||
labels: | ||
app: cayley | ||
spec: | ||
initContainers: | ||
- name: cayley-init | ||
image: quay.io/cayleygraph/cayley:v0.7.0-alpha | ||
command: | ||
- cayley | ||
- init | ||
- -c=/etc/cayley.json | ||
volumeMounts: | ||
- mountPath: /data | ||
name: database | ||
containers: | ||
- name: cayley | ||
image: quay.io/cayleygraph/cayley:v0.7.0-alpha | ||
command: | ||
- cayley | ||
- http | ||
- --init # TODO: remove once initContainers is out of beta | ||
- -c=/etc/cayley.json | ||
- --host=:64210 | ||
ports: | ||
- name: http | ||
containerPort: 64210 | ||
volumeMounts: | ||
- mountPath: /data | ||
name: database | ||
volumes: | ||
- name: database | ||
persistentVolumeClaim: | ||
claimName: cayley-pvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Running in Kubernetes | ||
|
||
Most examples requires Kubernetes 1.5+ and PersistentVolumes are configured. | ||
|
||
After running scripts namespace `cayley` will be created and service with the same name will be available in cluster. Service is of type `ClusterIP` by default. If you want to expose it, consider changing type to `LoadBalancer`. | ||
|
||
## Single instance (Bolt) | ||
|
||
This is a simplest possible configuration: single Cayley instance with persistent storage, using Bolt as a backend. | ||
|
||
```bash | ||
kubectl create -f ./docs/k8s/cayley-single.yml | ||
``` | ||
|
||
## Distributed (MongoDB cluster) | ||
|
||
This example is based on [thesandlord/mongo-k8s-sidecar](https://github.com/thesandlord/mongo-k8s-sidecar) and runs Cayley on top of 3-node Mongo cluster. | ||
|
||
```bash | ||
kubectl create -f ./docs/k8s/cayley-mongo.yml | ||
``` | ||
|
||
## Distributed | ||
|
||
*TODO: PostgreSQL, CockroachDB* |