Skip to content

adding kubernetes artifects #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Kubernetes artifects
==================

The Kubernetes replication controller assumes that you have a running Kubernetes environment.

The replication controller has 5 ports of rtp open. This means that it can take 5 calls in parallel. While this may not be an ideal situation for many use-cases, currently, there is no way to open a range of ports in Kubernetes.

Please hang tight, while we find a way to make this work or figure out another orchestration method.

How to use this?
==============
As stated, it is assumed that you have an environment which can run contianers via Kubernetes already set up. If not, please consider either gettting Google Container engine account or check out [this getting started doc](http://kubernetes.io/docs/getting-started-guides/) for Kubernetes.

Once you have the Kubernetes environment up, set up a replication controller. A replication controller will ensure that any containers that are in your Kubernetes pod are highly avaiable. Creating a replication controller is same regardless of your environment (Google cloud or bare metal).

```
$ kubectl create -f Restcomm-Docker/kubernetes/restcomm_rc.yml
replicationcontroller "restcomm-core-controller" created
```
Let us check if the pods are up yet.

```
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
restcomm-core-controller-cjq4q 1/1 Running 0 7m
```
Once we see that the `STATUS` is set to `running`, we can now expose the ports to outside world. This step will vary from infrastructure to infrastructure. For Google cloud, do the following:

```
$ kubectl expose rc restcomm-core-controller --type=LoadBalancer
service "restcomm-core-controller" exposed
```
The command above create a service for Google Container Enginer. It creates a load balancer and routes traffic from the load balancer to the Docker containers. If you are on any other kind of infrastructure, please create a [service](http://kubernetes.io/docs/user-guide/services/) manually for the same.
To obtainer the public IP of the load balancer, do:
```
kubectl get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.7.240.1 <none> 443/TCP 15m
restcomm-core-controller 10.7.240.42 104.199.139.229 80/TCP,443/TCP,9990/TCP,5060/TCP,5060/TCP,5061/TCP,5062/TCP,5063/TCP,65000/TCP,65001/TCP,65002/TCP,65003/TCP,65004/TCP 3m
```
Notice that there an IP in `EXTERNAL-IP` columnn against `restcomm-core-controller`. Copy that and open `https://<external-load-balancer-ip>`

65 changes: 65 additions & 0 deletions kubernetes/restcomm_rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: restcomm-core-controller
spec:
replicas: 1
selector:
app: restcomm-core
template:
metadata:
labels:
app: restcomm-core
spec:
containers:
- name: restcomm-core
image: restcomm/restcomm
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
- name: tcp9990
containerPort: 9990
protocol: TCP
- name: sip-tcp
containerPort: 5060
protocol: TCP
- name: sip-udp
containerPort: 5060
protocol: UDP
- name: sip-tls
containerPort: 5061
protocol: TCP
- name: sip-ws
containerPort: 5062
protocol: TCP
- name: sip-wss
containerPort: 5063
protocol: TCP
- name: rtp0
containerPort: 65000
protocol: UDP
- name: rtp1
containerPort: 65001
protocol: UDP
- name: rtp2
containerPort: 65002
protocol: UDP
- name: rtp3
containerPort: 65003
protocol: UDP
- name: rtp4
containerPort: 65004
protocol: UDP
env:
- name: ENVCONFURL
value: https://raw.githubusercontent.com/RestComm/Restcomm-Docker/master/scripts/restcomm_env_locally.sh
- name: STATIC_ADDRESS
value: 192.168.0.71
- name: MEDIASERVER_LOWEST_PORT
value: "65000"
- name: MEDIASERVER_HIGHEST_PORT
value: "65004"