Skip to content

Commit

Permalink
Updated k8s files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fonoster Team committed May 24, 2019
1 parent 0434e57 commit d89e58b
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 66 deletions.
15 changes: 15 additions & 0 deletions k8s/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This document is a short guide about running the dockerized version of Routr Server on Kubernetes.

## Run in Kubernetes

To run Routr in Kubernetes, you must set your ROUTR_EXTERN_ADDR in `k8s/routr.yml`.

> This variable must be set to the public address(if running Routr locally, use your host address)
Additionally, you must create the following Kubernetes resources:

```bash
kubectl create -f k8s/configmaps.yml
kubectl create -f k8s/redis.yml
kubectl create -f k8s/routr.yml
```
15 changes: 14 additions & 1 deletion k8s/boostrap.yaml → k8s/configmaps.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: routr-bootstrap
name: entrypoint
data:
entrypoint.sh: |-
while ! nc -z redis 6379; do sleep 0.1; done # Wait for Redis
cd /opt/routr
./run.sh &
while ! nc -z localhost 4567; do sleep 0.1; done # Wait for Sip I/O
./rctl create -f bootstrap.yml
while sleep 3600; do :; done
---
apiVersion: v1
kind: ConfigMap
metadata:
name: bootstrap
data:
bootstrap.yml: |-
- apiVersion: v1draft1
Expand Down
18 changes: 0 additions & 18 deletions k8s/gcs/config.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions k8s/gcs/entrypoint.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions k8s/gcs/service.yaml

This file was deleted.

36 changes: 36 additions & 0 deletions k8s/redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: Service
metadata:
name: redis
labels:
app: routr
spec:
ports:
- port: 6379
selector:
app: routr
tier: database
clusterIP: None
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redis
labels:
app: routr
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: routr
tier: database
spec:
containers:
- name: redis
image: redis:4.0.5-alpine
imagePullPolicy: Always
ports:
- containerPort: 6379
name: redis
51 changes: 32 additions & 19 deletions k8s/gcs/deployment.yaml → k8s/routr.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: routr
labels:
app: routr
spec:
type: NodePort
externalTrafficPolicy: Local # This will cause the load balancer to send the client ip
externalIPs:
- 192.168.1.127
ports:
- name: sip
port: 5060
- name: https
port: 4567
selector:
app: routr
tier: sip
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
Expand All @@ -11,7 +31,7 @@ spec:
metadata:
labels:
app: routr
tier: signaling
tier: sip
spec:
containers:
- name: routr
Expand All @@ -20,35 +40,28 @@ spec:
command: ["/bin/sh"]
args: ["-c", "sh /opt/routr/entrypoint.sh"]
env:
# Uncommend to point to an external redis
#- name: ROUTR_DS_PROVIDER
# value: 'redis_data_provider'
#- name: ROUTR_DS_PARAMETERS
# value: 'host=redis,port=6379'
- name: ROUTR_DS_PROVIDER
value: redis_data_provider
- name: ROUTR_DS_PARAMETERS
value: 'host=redis,port=6379'
- name: ROUTR_EXTERN_ADDR
value: '35.231.210.78' # This must be set manually (for now...)
value: '192.168.1.127'
ports:
- containerPort: 5060
name: sip
- containerPort: 4567
name: https
volumeMounts:
- name: routr-config
mountPath: /opt/routr/config/config.yml
subPath: config.yml
- name: routr-entrypoint
- name: entrypoint
mountPath: /opt/routr/entrypoint.sh
subPath: entrypoint.sh
- name: routr-bootstrap
- name: bootstrap
mountPath: /opt/routr/bootstrap.yml
subPath: bootstrap.yml
volumes:
- name: routr-config
configMap:
name: routr-config
- name: routr-entrypoint
- name: entrypoint
configMap:
name: routr-entrypoint
- name: routr-bootstrap
name: entrypoint
- name: bootstrap
configMap:
name: routr-bootstrap
name: bootstrap

0 comments on commit d89e58b

Please sign in to comment.