iT邦幫忙

2022 iThome 鐵人賽

DAY 25
1
DevOps

從零開始的Kubernetes轉換系列 第 25

Day 25 Jaeger 與 ElasticSearch在kubernetes上的串接

  • 分享至 

  • xImage
  •  

首先我們利用ecs快速的部署我們的elastic search

kubectl create -f https://download.elastic.co/downloads/eck/2.4.0/crds.yaml
kubectl apply -f https://download.elastic.co/downloads/eck/2.4.0/operator.yaml
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 7.17.6  
  nodeSets:
  - name: default
    count: 1
    config:
      node.store.allow_mmap: false
EOF

接下來測試我們的Elasticsearch

kubectl get svc
kubernetes                    ClusterIP   10.24.128.1     <none>        443/TCP    33m
quickstart-es-default         ClusterIP   None            <none>        9200/TCP   28m
quickstart-es-http            ClusterIP   10.24.129.159   <none>        9200/TCP   28m
quickstart-es-internal-http   ClusterIP   10.24.128.157   <none>        9200/TCP   28m
quickstart-es-transport       ClusterIP   None            <none>        9300/TCP   28m
kubectl port-forward service/quickstart-es-default 9200:9200
Forwarding from 127.0.0.1:9200 -> 9200
Forwarding from [::1]:9200 -> 9200
Handling connection for 9200
PASSWORD=$(kubectl get secret quickstart-es-elastic-user -o go-template='{{.data.elastic | base64decode}}')
curl -u "elastic:$PASSWORD" -k "https://localhost:9200"                                      20:26:30      51% (1:18) 

{
  "name" : "quickstart-es-default-0",
  "cluster_name" : "quickstart",
  "cluster_uuid" : "uUUFJmo_QdyjyCm2fQDKOQ",
  "version" : {
    "number" : "7.17.6",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "f65e9d338dc1d07b642e14a27f338990148ee5b6",
    "build_date" : "2022-08-23T11:08:48.893373482Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

這邊我們可以測試elastic search node已經正常運作了
接下來是安裝jaeger,首先我們要把ES的password建立secret給jaeger用

PASSWORD=$(kubectl get secret quickstart-es-elastic-user -o=jsonpath='{.data.elastic}' | base64 --decode)
kubectl create secret generic jaeger-secret --from-literal=ES_PASSWORD=${PASSWORD} --from-literal=ES_USERNAME=elastic

接下來安裝cert-manager

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.6.3/cert-manager.yaml

最後安裝jaeger

kubectl create namespace observability
kubectl create -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.37.0/jaeger-operator.yaml -n observability
cat <<EOF | kubectl apply -f -
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
  name: simple-prod
spec:
  strategy: production
  storage:
    type: elasticsearch
    options:
      es:
        server-urls: https://quickstart-es-http:9200
        tls:
          ca: /es/certificates/ca.crt
        num-shards: 1
        num-replicas: 0
    secretName: jaeger-secret
  volumeMounts:
    - name: certificates
      mountPath: /es/certificates/
      readOnly: true
  volumes:
    - name: certificates
      secret:
        secretName: quickstart-es-http-certs-public
EOF

然後把jaeger-query port-forward出來就可以看到ui啦


上一篇
Day 24 Jaeger, Zipkin, Signoz
下一篇
Day 26 Dockerfile Refine python篇
系列文
從零開始的Kubernetes轉換30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言