kamailio-etcd-dispatcher icon indicating copy to clipboard operation
kamailio-etcd-dispatcher copied to clipboard

in akamailio-etcd-dispatcher return error code "HPE_INVALID_CONSTANT" when trying to connect to etcd3 in kubernetes cluster

Open hshtel opened this issue 5 years ago • 0 comments

we need to use kamailio-etcd-dispatcher in kubernetes cluster. but when trying to announce asterisk pod we get below error:

root@crbt-asterisk-cc8d9d878-jl4sw:/usr/sbin# etcd-dispatcher --announce --etcdhost 172.1.1.77 -o 2379 --timeout 5500
[2019-06-16T13:23:42.899Z] ERROR: kamailio-etcd-dispatcher/2032 on crbt-asterisk-cc8d9d878-jl4sw:  (label=check_etcd_alive)

    --
    content: {
      "note": "could not see that etcd is alive",
      "error": {
        "bytesParsed": 0,
        "code": "HPE_INVALID_CONSTANT",
        "reason": "Expected HTTP/"
      },
      "httpoptions": {
        "hostname": "172.1.1.77",
        "port": 2379,
        "path": "/version",
        "method": "GET",
        "headers": {
          "Content-Type": "application/json"
        }
      }
    }
/usr/lib/node_modules/kamailio-etcd-dispatcher/app.js:72
                        throw err;
                        ^

Error: Parse Error
    at Socket.socketOnData (_http_client.js:452:22)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:166:17) {
  bytesParsed: 0,
  code: 'HPE_INVALID_CONSTANT',
  reason: 'Expected HTTP/'

below is the cluster etcd service:

root@k8-master:~# ps -ef | grep etcd
root      1287     1  2 06:19 ?        00:10:37 /snap/kube-apiserver/998/kube-apiserver --advertise-address=172.1.1.77 --min-request-timeout=300 --etcd-cafile=/root/cdk/etcd/client-ca.pem --etcd-certfile=/root/cdk/etcd/client-cert.pem --etcd-keyfile=/root/cdk/etcd/client-key.pem --etcd-servers=https://172.1.1.77:2379 --storage-backend=etcd3 --tls-cert-file=/root/cdk/server.crt --tls-private-key-file=/root/cdk/server.key --insecure-bind-address=127.0.0.1 --insecure-port=8080 --audit-log-maxbackup=9 --audit-log-maxsize=100 --audit-log-path=/root/cdk/audit/audit.log --audit-policy-file=/root/cdk/audit/audit-policy.yaml --basic-auth-file=/root/cdk/basic_auth.csv --client-ca-file=/root/cdk/ca.crt --requestheader-allowed-names=system:kube-apiserver --requestheader-client-ca-file=/root/cdk/ca.crt --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --service-account-key-file=/root/cdk/serviceaccount.key --token-auth-file=/root/cdk/known_tokens.csv --authorization-mode=AlwaysAllow --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota --allow-privileged --enable-aggregator-routing --kubelet-certificate-authority=/root/cdk/ca.crt --kubelet-client-certificate=/root/cdk/client.crt --kubelet-client-key=/root/cdk/client.key --kubelet-preferred-address-types=[InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP] --proxy-client-cert-file=/root/cdk/client.crt --proxy-client-key-file=/root/cdk/client.key --service-cluster-ip-range=10.152.183.0/24 --logtostderr --v=4
root      1342     1  1 06:19 ?        00:06:21 /snap/etcd/202/bin/etcd --config-file /var/snap/etcd/common/etcd.conf.yml

below is npm and nodjs version:

root@crbt-asterisk-cc8d9d878-jl4sw:/usr/sbin# npm -v
6.9.0
root@crbt-asterisk-cc8d9d878-jl4sw:/usr/sbin# node -v
v12.4.0

we think that kamailio-etcd-dispatcher send http request to etcd to announce the new asterisk while the deployed etcd listen on https (etcd3).

hshtel avatar Jun 16 '19 13:06 hshtel