Search code examples
kubernetesefk

K8s integrate EFK, status code 406 is thrown out


I have 3 virtual machines (VirtualBox centos 7.4) on my win10. I try to configure EFK so that I could monitor logs. I have 1master + 2nodes, master also has kubelet.

I follow the instructions made by this link. I did not change downloaded kubernetes/cluster/addons/fluentd-elasticsearch,

I did not do following since I am using cloud-specific service.

volumeClaimTemplates:
  - metadata:
      name: elasticsearch-logging
    spec:
      accessModes: ["ReadWriteOnce"]
      storageClassName: managed-premium
      resources:
        requests:
          storage: 64Gi

I changed image link mostly Chinese mirror site to gcr.io.

In the link, it says,

I had one issue during my installation of Elasticsearch. For whatever reason, Elasticsearch did not automatically assign missing shards to a server, and it was necessary to shell into one of the elasticsearch pods and then turn on automatic shard assignment:

I follow the instructions,

$ kubectl exec -it elasticsearch-logging-0 -n kube-system -- /bin/bash
$ curl -XPUT 'http://elasticsearch-logging:9200/_cluster/settings' -d '{ "transient": { "cluster.routing.allocation.enable": "all" } }'

But I follow the instructions and got the error, status code 406.

{“error”:”Content-Type header [application/x-www-form-urlencoded] is not supported”,”status”:406}

Any hints. what could I do?


Solution

  • You are missing the header. Try out this:

    curl -XPUT 'http://elasticsearch-logging:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{ "transient": { "cluster.routing.allocation.enable": "all" } }'