CyCoreSystems / asterisk-k8s-demo

Demo of scalable Asterisk on Kubernetes
Apache License 2.0
158 stars 72 forks source link

Issues deploying to on-premise kubernetes cluster #15

Closed Martin-Hogge closed 4 years ago

Martin-Hogge commented 4 years ago

Hi,

I tried to setup asterisk onto my kubernetes cluster but without successes and I'm not sure on what is going wrong here.

What I did:

Issues I'm facing:

Asterisk config container CrashLoopBackOff

2020/04/03 14:34:20 Waiting for Asterisk to be ready...
2020/04/03 14:34:20 service exited: failed to render defaults: template: t:5:12: executing "t" at <.Network>: error calling Network: Get "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip": dial tcp: lookup metadata.google.internal on 10.43.0.10:53: server misbehaving
2020/04/03 14:34:20 asterisk-config exiting

Kamailio dispatchers CrashLoopBackOff

2020/04/03 14:38:05 WARNING: failed to get node <ip-asterisk-node> for endpoint asterisk: kubernetes api: Failure 403 nodes "<ip-asterisk-node>" is forbidden: User "system:serviceaccount:voip:default" cannot get resource "nodes" in API group "" at the cluster scope
2020/04/03 14:38:05 run died: failed to run initial dispatcher set update: kubernetes api: Failure 403 nodes "<ip-asterisk-node>" is forbidden: User "system:serviceaccount:voip:default" cannot get resource "nodes" in API group "" at the cluster scope
2020/04/03 14:38:05 too many short-term deaths

But I did well create the role & rolebinding as they are described here in this repository.

Kamailio container is running with errors

The container is running but when looking at the logs I see several errors:

21(53) ERROR: rtpproxy [rtpproxy.c:1476]: send_rtpp_command(): can't send command to a RTP proxy
21(53) ERROR: rtpproxy [rtpproxy.c:1511]: send_rtpp_command(): proxy <udp:localhost:7722> does not respond, disable it

I'm very new to asterisk and PBX stuffs so I'm a bit lost here and any hints on the direction I should follow in order to get it up and running on my kubernetes cluster would be welcome.

Thank you.

Ulexus commented 4 years ago

The asterisk-config crash is because it still has CLOUD=gcp somewhere. My guess is that you may have changed it for one container in the Pod, but not all.

The dispatchers error is definitely an RBAC problem. I would double-check the RoleBinding there.

The kamailio error is indicating rtpproxy is not running, so you'll need to check that container in the kamailio Pod. It's probably another non-updated CLOUD variable.

Martin-Hogge commented 4 years ago

The asterisk-config crash is because it still has CLOUD=gcp somewhere. My guess is that you may have changed it for one container in the Pod, but not all.

Indeed I've forgotten to update the CLOUD variable in the asterisk deployment.

The dispatchers error is definitely an RBAC problem. I would double-check the RoleBinding there.

At a first glance the RBAC seems good as when I'm running

kubectl auth can-i get nodes --as=system:serviceaccount:voip:default -n voip

I get a yes response. But I'm still investigating on this one.

The kamailio error is indicating rtpproxy is not running, so you'll need to check that container in the kamailio Pod. It's probably another non-updated CLOUD variable.

I've updated the 2 CLOUD variable in the yaml deployment. Should I've updated elsewhere ? The rtpproxy seems good as the pod is in a running state and the logs shows

INFO:main:GLOBAL: rtpproxy started, pid 1

Thank you for your time and your help.