Bladeren bron

dsfsadfasdfsdfasdf

yangxg 4 jaren geleden
bovenliggende
commit
72306bb416
2 gewijzigde bestanden met toevoegingen van 182 en 3 verwijderingen
  1. 6 3
      deploy-tmp-logstash.yaml
  2. 176 0
      offline-process-charge.yml

+ 6 - 3
deploy-tmp-logstash.yaml

@@ -7,9 +7,12 @@ metadata:
 data:
   logstash-config-named-k8s: |
     input {
-      tcp {
-        port => 5000
-      }
+      kafka {
+          bootstrap_servers => ["kafka-0.kafka-svc.qa.svc.cluster.local:9093,kafka-1.kafka-svc.qa.svc.cluster.local:9093,kafka-2.kafka-svc.qa.svc.cluster.local:9093"]
+          group_id => "es-test"
+          topics => ["offline-process-charge-topic"]
+          codec => json
+     }
     }
     
     filter {

+ 176 - 0
offline-process-charge.yml

@@ -0,0 +1,176 @@
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: offline-process-charge
+  namespace: qa
+  labels:
+    app: offline-process-charge
+spec:
+  serviceName: offline-process-charge
+  replicas: 1
+  selector:
+    matchLabels:
+      app: offline-process-charge
+  template:
+    metadata:
+      labels:
+        app: offline-process-charge
+    spec:
+      terminationGracePeriodSeconds: 60
+      initContainers:
+        - name: init
+          image: hub.evbj.easou.com/dev/busybox
+          command: [ "chmod","777","-R","/data" ]
+          imagePullPolicy: Always
+          volumeMounts:
+            - name: volume
+              mountPath: /data
+      #nodeSelector:
+      #  app.touchrs: touchrs
+      containers:
+        - name: offline-process-charge
+          image: hub.evbj.easou.com/qa/offline-process-charge:v1.0.40
+          imagePullPolicy: Always
+          env:
+            - name: JAVA_OPTS
+              value: "-server  -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=n  -Xmx2g -Xms2g -Xss512k -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=test"
+          ports:
+            - containerPort: 8080
+              name: port
+            - containerPort: 8001
+              name: "jvm-debug"
+          volumeMounts:
+            - name: volume
+              mountPath: /data
+          lifecycle:
+            preStop:
+              exec:
+                command: ["/bin/sh","-c","curl -X POST 127.0.0.1:8080/actuator/shutdown"]
+          livenessProbe:
+            httpGet:
+              path: /actuator/health
+              port: 8080
+              httpHeaders:
+                - name: Custom-Header
+                  value: Awesome
+                - name: Custom-Header
+                  value: Awesome
+            initialDelaySeconds: 30        #60s后启动第一次探测
+            periodSeconds: 10              # 每隔10s启动一次探测
+            timeoutSeconds: 3              # 超时时间3s
+            successThreshold: 1            # 成功1次即表示容器健康
+            failureThreshold: 5            # 连续5次失败,则判定容器不健康,默认3次
+          readinessProbe:
+            tcpSocket:
+              port: 8080
+            initialDelaySeconds: 30
+            periodSeconds: 15
+        - image: docker.elastic.co/beats/filebeat:6.8.12
+          imagePullPolicy: Always
+          name: filebeat
+          env:
+            - name: ELASTICSEARCH_HOST
+              value: elasticsearch
+            - name: ELASTICSEARCH_PORT
+              value: "9200"
+            - name: ELASTICSEARCH_USERNAME
+              value: elastic
+            - name: ELASTICSEARCH_PASSWORD
+              value: changeme
+            - name: KIBANA_HOST
+              value: kibana
+            - name: KIBANA_PORT
+              value: "5601"
+          volumeMounts:
+            - name: volume #日志同时挂载在nginx和filebeat中
+              mountPath: /data
+            - name: filebeat-config
+              mountPath: /usr/share/filebeat/filebeat.yml
+              subPath: filebeat.yml
+      volumes:
+        - name: filebeat-config
+          configMap:
+            name: filebeat-config-offline-process-charge
+            items:
+              - key: filebeat.yml
+                path: filebeat.yml
+
+  volumeClaimTemplates:
+    - metadata:
+        name: volume
+      spec:
+        accessModes: [ "ReadWriteOnce" ]
+        storageClassName: rbd
+        resources:
+          requests:
+            storage: 100Gi
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: offline-process-charge-svc
+  namespace: qa
+  labels:
+    app: offline-process-charge-svc
+spec:
+  type: NodePort
+  ports:
+    - port: 80
+      targetPort: 8080
+      name: "main"
+  selector:
+    app: offline-process-charge
+---
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: offline-process-charge-ingress
+  namespace: qa
+  annotations:
+    kubernetes.io/ingress.class: nginx
+spec:
+  rules:
+    - host: qa-offline-process-charge.ieasou.cn
+      http:
+        paths:
+          - path: /
+            backend:
+              serviceName: offline-process-charge-svc
+              servicePort: 80
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: filebeat-config-offline-process-charge
+  namespace: qa
+data:
+  filebeat.yml: |
+    filebeat.inputs:
+    - type: log
+      enabled: true
+      #多行合并
+      multiline.pattern: '^\[[0-9]{4}-[0-9]{2}-[0-9]{2}'
+      multiline.negate: true
+      multiline.match: after
+      multiline.timeout: 30
+      paths:
+        - "/data/logs/app/all.log"
+        - "/data/logs/*.log"
+    setup.template.enabled: true
+    setup.template.name: offline-process-charge
+    setup.template.pattern: offline-process-charge*
+    setup.dashboards.enabled: true
+    output.kafka:
+      # initial brokers for reading cluster metadata
+      hosts: ["kafka-0.kafka-svc.qa.svc.cluster.local:9093", "kafka-1.kafka-svc.qa.svc.cluster.local:9093", "kafka-2.kafka-svc.qa.svc.cluster.local:9093"]
+      # message topic selection + partitioning
+      topic: 'offline-process-charge-topic'
+      partition.round_robin:
+        reachable_only: false
+      required_acks: 1
+      compression: gzip
+      max_message_bytes: 1000000
+    setup.kibana:
+      host: 'qa-kibana.ieasou.cn:80'
+#       host: 'kibana-svc:80'