Added kubernetes yaml files

This commit is contained in:
Kersten Burkhardt 2017-10-24 15:57:42 +02:00
parent c928b958f4
commit 3efca6cd8b
11 changed files with 355 additions and 0 deletions

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: zammad

42
kubernetes/10_pvc.yaml Normal file
View File

@ -0,0 +1,42 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zammad-postgresql
namespace: zammad
annotations:
volume.beta.kubernetes.io/storage-class: standard
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10G
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zammad-elasticsearch
namespace: zammad
annotations:
volume.beta.kubernetes.io/storage-class: standard
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10G
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: zammad-home
namespace: zammad
annotations:
volume.beta.kubernetes.io/storage-class: standard
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10G

View File

@ -0,0 +1,32 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: zammad-postgresql
namespace: zammad
labels:
component: database
app: postgresql
spec:
serviceName: zammad-postgresql
replicas: 1
template:
metadata:
labels:
component: database
app: postgresql
spec:
terminationGracePeriodSeconds: 10
volumes:
- name: zammad-postgresql
persistentVolumeClaim:
claimName: zammad-postgresql
containers:
- name: zammad-postgresql
image: zammad/zammad-docker-compose:zammad-postgresql
ports:
- containerPort: 5432
name: postgresql
imagePullPolicy: Always
volumeMounts:
- mountPath: /var/lib/postgresql
name: zammad-postgresql

View File

@ -0,0 +1,32 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: zammad-elasticsearch
namespace: zammad
labels:
component: database
app: elasticsearch
spec:
serviceName: zammad-elasticsearch
replicas: 1
template:
metadata:
labels:
component: searchindex
app: elasticsearch
spec:
terminationGracePeriodSeconds: 10
volumes:
- name: zammad-elasticsearch
persistentVolumeClaim:
claimName: zammad-elasticsearch
containers:
- name: zammad-elasticsearch
image: zammad/zammad-docker-compose:zammad-elasticsearch
ports:
- containerPort: 9200
name: elasticsearch
imagePullPolicy: Always
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: zammad-elasticsearch

View File

@ -0,0 +1,33 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: zammad-railsserver
namespace: zammad
labels:
component: railsserver
app: zammad
spec:
serviceName: zammad-railsserver
replicas: 1
template:
metadata:
labels:
component: railsserver
app: zammad
spec:
terminationGracePeriodSeconds: 10
volumes:
- name: zammad-home
persistentVolumeClaim:
claimName: zammad-home
containers:
- name: zammad-railsserver
image: zammad/zammad-docker-compose:zammad-railsserver
imagePullPolicy: Always
args: ["zammad-railsserver"]
ports:
- containerPort: 3000
name: railsserver
volumeMounts:
- mountPath: /home/zammad
name: zammad-home

View File

@ -0,0 +1,33 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: zammad-websocket
namespace: zammad
labels:
component: websocket
app: zammad
spec:
serviceName: zammad-websocket
replicas: 1
template:
metadata:
labels:
component: websocket
app: zammad
spec:
terminationGracePeriodSeconds: 10
volumes:
- name: zammad-home
persistentVolumeClaim:
claimName: zammad-home
containers:
- name: zammad-websocket
image: zammad/zammad-docker-compose:zammad
args: [ "zammad-websocket" ]
ports:
- containerPort: 6042
name: websocket
imagePullPolicy: Always
volumeMounts:
- mountPath: /home/zammad
name: zammad-home

View File

@ -0,0 +1,32 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: zammad-nginx
namespace: zammad
labels:
component: nginx
app: zammad
spec:
serviceName: zammad-nginx
replicas: 1
template:
metadata:
labels:
component: nginx
app: zammad
spec:
terminationGracePeriodSeconds: 10
volumes:
- name: zammad-home
persistentVolumeClaim:
claimName: zammad-home
containers:
- name: zammad-nginx
image: zammad/zammad-docker-compose:zammad-nginx
ports:
- containerPort: 80
name: nginx
imagePullPolicy: Always
volumeMounts:
- mountPath: /home/zammad
name: zammad-home

View File

@ -0,0 +1,30 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: zammad-scheduler
namespace: zammad
labels:
component: scheduler
app: zammad
spec:
serviceName: zammad-scheduler
replicas: 1
template:
metadata:
labels:
component: scheduler
app: zammad
spec:
terminationGracePeriodSeconds: 10
volumes:
- name: zammad-home
persistentVolumeClaim:
claimName: zammad-home
containers:
- name: zammad-scheduler
image: zammad/zammad-docker-compose:zammad
args: [ "zammad-scheduler" ]
imagePullPolicy: Always
volumeMounts:
- mountPath: /home/zammad
name: zammad-home

85
kubernetes/80_sv.yaml Normal file
View File

@ -0,0 +1,85 @@
---
kind: Service
apiVersion: v1
metadata:
name: zammad-postgresql
namespace: zammad
labels:
component: database
app: postgresql
spec:
ports:
- name: postgresql
port: 5432
selector:
component: database
app: postgresql
type: NodePort
---
kind: Service
apiVersion: v1
metadata:
name: zammad-elasticsearch
namespace: zammad
labels:
component: searchindex
app: elasticsearch
spec:
ports:
- name: elasticsearch
port: 9200
selector:
component: searchindex
app: elasticsearch
type: NodePort
---
kind: Service
apiVersion: v1
metadata:
name: zammad-railsserver
namespace: zammad
labels:
component: railsserver
app: zammad
spec:
ports:
- name: railsserver
port: 3000
selector:
component: railsserver
app: zammad
type: NodePort
---
kind: Service
apiVersion: v1
metadata:
name: zammad-websocket
namespace: zammad
labels:
component: websocket
app: zammad
spec:
ports:
- name: websocket
port: 6042
selector:
component: websocket
app: zammad
type: NodePort
---
kind: Service
apiVersion: v1
metadata:
name: zammad-nginx
namespace: zammad
labels:
component: nginx
app: zammad
spec:
ports:
- name: nginx
port: 80
selector:
component: nginx
app: zammad
type: NodePort

View File

@ -0,0 +1,25 @@
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: zammad.example.com
namespace: zammad
labels:
component: website
app: zammad
host: zammad.example.com
annotations:
ingress.kubernetes.io/ssl-redirect: 'true'
kubernetes.io/tls-acme: 'true'
spec:
tls:
- hosts:
- zammad.example.com
secretName: zammad-example-com-tls
rules:
- host: zammad.example.com
http:
paths:
- path: /
backend:
serviceName: zammad-nginx
servicePort: 80

7
kubernetes/Readme.md Normal file
View File

@ -0,0 +1,7 @@
# Zammad kubernetes example deployment
## Perquisites
- On every node you need to set `sysctl -w vm.max_map_count=262144`
- Change the ingress to your needs.
- Hit `kubectl apply -f ./` and wait till everything is setup.