2

I have a kubernetes cluster on google cloud platform, and on it, I have a jaeger deployment via development setup of jaeger-kubernetes templates because my purpose is setup elasticsearch like backend storage, due to this, I follow the jaeger-kubernetes github documentation with the following actions

Here are configured the URLs to access to elasticsearch server and username and password and ports

kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/production-elasticsearch/configmap.yml

And here, there are configured the download of docker images of the elasticsearch service and their volume mounts.

kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/production-elasticsearch/elasticsearch.yml

And then, at this moment we have a elasticsearch service running over 9200 and 9300 ports

 kubectl get service elasticsearch                                                                                                                                [a89fbe2]
NAME            TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE
elasticsearch   ClusterIP   None         <none>        9200/TCP,9300/TCP   1h
  • I've follow with the creation of jaeger components using the kubernetes-jaeger production templates of this way:

λ bgarcial [~] → kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/jaeger-production-template.yml        
deployment.extensions/jaeger-collector created
service/jaeger-collector created
service/zipkin created
deployment.extensions/jaeger-query created
service/jaeger-query created
daemonset.extensions/jaeger-agent created

λ bgarcial [~/workspace/jaeger-elastic] at  master ?

According to the Jaeger architecture, the jaeger-collector and jaeger-query services require access to backend storage.

And so, these are my services running on my kubernetes cluster:

λ bgarcial [~/workspace/jaeger-elastic] at  master ?
→ kubectl get services                                                                                  [baefdf9]
NAME               TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                        AGE
elasticsearch      ClusterIP      None            <none>           9200/TCP,9300/TCP              3h
jaeger-collector   ClusterIP      10.55.253.240   <none>           14267/TCP,14268/TCP,9411/TCP   3h
jaeger-query       LoadBalancer   10.55.248.243   35.228.179.167   80:30398/TCP                   3h
kubernetes         ClusterIP      10.55.240.1     <none>           443/TCP                        3h
zipkin             ClusterIP      10.55.240.60    <none>           9411/TCP                       3h

λ bgarcial [~/workspace/jaeger-elastic] at  master ?
  • I going to configmap.yml elastic search file kubectl edit configmap jaeger-configuration command in order to try to edit it in relation to the elasticsearch URLs endpoints (may be? ... At this moment I am supossing that this is the next step ...)

I execute it:

λ bgarcial [~] → kubectl edit configmap jaeger-configuration 

And I get the following edit entry:

 apiVersion: v1
data:
  agent: |
    collector:
      host-port: "jaeger-collector:14267"
  collector: |
    es:
      server-urls: http://elasticsearch:9200
      username: elastic
      password: changeme
    collector:
      zipkin:
        http-port: 9411
  query: |
    es:
      server-urls: http://elasticsearch:9200
      username: elastic
      password: changeme
  span-storage-type: elasticsearch
kind: ConfigMap
metadata:
  creationTimestamp: "2018-12-27T13:24:11Z"
  labels:
    app: jaeger
    jaeger-infra: configuration
  name: jaeger-configuration
  namespace: default
  resourceVersion: "1387"
  selfLink: /api/v1/namespaces/default/configmaps/jaeger-configuration
  uid: b28eb5f4-09da-11e9-9f1e-42010aa60002

Here ... do I need setup our own URLs to collector and query services, which will be connect wiht elasticsearch backend service?

How to can I setup the elasticsearch IP address or URLs here?

In the jaeger components, the query and collector need access to storage, but I don't know what is the elastic endpoint ...

Is this server-urls: http://elasticsearch:9200 a correct endpoint?

I am starting in the kubernetes and DevOps world, and I appreciate if someone can help me in the concepts and point me in the right address in order to setup jaeger and elasticsearch as a backend storage.

bgarcial
  • 2,915
  • 10
  • 56
  • 123

1 Answers1

1

When you are accessing the service from the pod in the same namespace you can use just the service name. Example:

http://elasticsearch:9200

If you are accessing the service from the pod in the different namespace you should also specify the namespace. Example:

http://elasticsearch.mynamespace:9200
http://elasticsearch.mynamespace.svc.cluster.local:9200

To check in what namespace the service is located, use the following command:

kubectl get svc --all-namespaces -o wide

Note: Changing ConfigMap does not apply it to deployment instantly. Usually, you need to restart all pods in the deployment to apply new ConfigMap values. There is no rolling-restart functionality at the moment, but you can use the following command as a workaround:
(replace deployment name and pod name with the real ones)

kubectl patch deployment mydeployment -p '{"spec":{"template":{"spec":{"containers":[{"name":"my-pod-name","env":[{"name":"START_TIME","value":"'$(date +%s)'"}]}]}}}}'
Black_Bacardi
  • 324
  • 4
  • 10
VAS
  • 8,538
  • 1
  • 28
  • 39
  • Very useful your answer, thanks. What if I have an elastic endpoint outside of my kubernetes cluster. I've created an elastic instance on https://cloud.elastic.co and my endpoint is this, listening under 9243 port instead of 9200 https://c385ec84452f4376aec843134faf49f2.europe-west1.gcp.cloud.es.io:9243/ Should I setup the `server-urls:` directive of this way?: `server-urls:https://c385ec84452f4376aec843134faf49f2.europe-west1.gcp.cloud.es.io:9243/` – bgarcial Dec 28 '18 at 05:40
  • 1
    In this case you can use ExternalName type of Service for shortening an external link. For detailed explanation please follow this link: https://kubernetes.io/docs/concepts/services-networking/service/#externalname More examples you can find here: https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services – VAS Jan 02 '19 at 15:53
  • What is the restart pod process consist of? You are referencing me this command for this purpose? `kubectl patch deployment mydeployment -p '{"spec":{"template":{"spec":{"containers":[{"name":"my-pod-name","env":[{"name":"START_TIME","value":"'$(date +%s)'"}]}]}}}}'` I have been reading some posts blogs and speak about that, but I haven't clear how to restart the pods, because many sites talk about it depending of the way in that they has been created, and when I delete some pods via `kubectl ...` GKE inmediately create other pod with similar characteristics. – bgarcial Jan 10 '19 at 15:24
  • Even recommend go to the specific container (s) inside the pod and restart or kill the process container inside the pod, like strategic to restart ..https://stackoverflow.com/a/47799862/2773461 I am a few intrigued about it. – bgarcial Jan 10 '19 at 15:24
  • 1
    That command starts a rolling update of the deployment (restarts all pods of this deployments with respect to update settings), because you change the pod specification, even if you only change the value of environment variable. Date is used to ensure that the value of the variable will change each time you run the command. – VAS Jan 10 '19 at 22:54