Closed isaldarriaga closed 7 years ago
It's complaining about line 35 being invalid. Line 35 is the alias line, which means you're almost certainly failing the hostname or public IP address lookups in the entrypoint script.
I would run, manually, those curl
commands and make sure you are getting reasonable results. Failing that, modify the entrypoint script to echo out the resulting environment variables.
The lookups seems to be working fine from inside a running container in the kamailio pod (i havent' printed the vars from the entrypoint yet):
$ kubectl exec -it kamailio-t9bjr -c rtpproxy -- sh
/ # curl -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip
35.xxx.191.224
/ # curl -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip
10.138.0.2
/ # curl -H 'Metadata-Flavor: Google' http://metadata.google.internal/computeMetadata/v1/instance/hostname
gke-foo-cluster-default-pool-72561ba1-992g.c.foo-project.internal
/ # exit
I'm trying to understand better the alias code here.
The kamailio.conf is a dummy file in the source code, but as far as i understand it's copied at runtime from live-demo/kamailio/confd-env/templates/kamailio.cfg.tmpl, right?
(evidenced in the log entry: 2017-08-24T00:18:25Z gke-foo-cluster-default-pool-72561ba1-992g confd[13]: INFO Target config /etc/kamailio/kamailio.cfg has been updated
)
In the kamailio.cfg.tmpl line (35) we have:
##
# Manual addition of aliased hostnames held by the local server. This
# adds hostname/port tuples to the list of destinations that match the
# 'myself' keyword and are considered local by loose_route(). It is
# necessary to provide both the hostname and the port (e.g. alias=host:5060)
# for this to work properly. These entries supplement local aliases
# automatically discovered in /etc/hosts. Multiple 'alias' entries may
# be present.
alias=sip.astricon.cycore.io {{getv "/public/ipv4"}} {{getv "/public/hostname"}}
According to the document we need a tuple hostname:port, but only the ip is returned by the curl
command. Is this relevant?
Aha, you're exactly correct. They do need the port. I wonder why that is missing... oh, well, yes. It is obviously wrong, and it needs the port number
I changed the alias line in kamailio.cfg.tmpl :
alias="{{getv "/public/hostname"}}:5060"
since GCE FQDNs have dashes, the alias need to be enclosed in double quotes too according to the kamailio specs.
Now the container starts up.
I labeled 1 node with cloud.google.com/gke-nodepool=pool-kamailio
so the DaemonSet launches the pod in one of the cluster nodes.
The "kamailio" container in the kamailio-xxx pod is failing though:
The error:
Looks like the software expects a specific checksum on the configuration file, then replace it and fails with the default values.
Any workaround?