123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- ---
- apiVersion: apps/v1
- kind: StatefulSet
- metadata:
- name: [APP]
- namespace: [ENV]
- labels:
- app: [APP]
- spec:
- serviceName: [APP]
- replicas: [REPLICA]
- selector:
- matchLabels:
- app: [APP]
- template:
- metadata:
- labels:
- app: [APP]
- spec:
- readinessGates:
- - conditionType: InPlaceUpdateReady
- terminationGracePeriodSeconds: 180
- dnsPolicy: ClusterFirstWithHostNet
- dnsConfig:
- nameservers:
- - 223.5.5.5
- - 114.114.114.114
- initContainers:
- - name: init
- image: hub.evbj.easou.com/dev/busybox
- command: [ "chmod","777","-R","/data" ]
- imagePullPolicy: IfNotPresent
- volumeMounts:
- - name: volume
- mountPath: /data
- #nodeSelector:
- # app.touchrs: touchrs
- affinity:
- podAntiAffinity:
- preferredDuringSchedulingIgnoredDuringExecution:
- - weight: 100
- podAffinityTerm:
- labelSelector:
- matchExpressions:
- - key: app
- operator: In
- values:
- - [APP]
- topologyKey: kubernetes.io/hostname
- containers:
- - name: [APP]
- image: hub.evbj.easou.com/[ENV]/[APP]:[TAG]
- imagePullPolicy: IfNotPresent
- env:
- - name: MY_NODE_NAME
- valueFrom:
- fieldRef:
- fieldPath: spec.nodeName
- - name: MY_POD_IP
- valueFrom:
- fieldRef:
- fieldPath: status.podIP
- - name: MY_POD_NAME
- valueFrom:
- fieldRef:
- fieldPath: metadata.name
- - name: MY_POD_NAMESPACE
- valueFrom:
- fieldRef:
- fieldPath: metadata.namespace
- - name: JAVA_OPTS
- value: "-server [DEBUG_OPTS] -Xmx2g -Xms2g -Xss512k -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=[PROFILE]"
- ports:
- - containerPort: 8080
- name: port
- - containerPort: 8001
- name: "jvm-debug"
- volumeMounts:
- - name: volume
- mountPath: /data
- lifecycle:
- preStop:
- exec:
- command: ["/bin/sh","-c","curl -H 'loginName:admin' -H 'password:ea1so2ua3dm4in5' -X POST 127.0.0.1:8080/actuator/shutdown"]
- livenessProbe:
- httpGet:
- path: /actuator/health
- port: 8080
- httpHeaders:
- - name: loginName
- value: admin
- - name: password
- value: ea1so2ua3dm4in5
- initialDelaySeconds: 40 #60s后启动第一次探测
- periodSeconds: 15 # 每隔10s启动一次探测
- timeoutSeconds: 3 # 超时时间3s
- successThreshold: 1 # 成功1次即表示容器健康
- failureThreshold: 5 # 连续5次失败,则判定容器不健康,默认3次
- readinessProbe:
- tcpSocket:
- port: 8080
- initialDelaySeconds: 40
- periodSeconds: 15
- - image: hub.evbj.easou.com/pro/filebeat:7.13.3
- imagePullPolicy: IfNotPresent
- name: filebeat
- 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-[APP]
- items:
- - key: filebeat.yml
- path: filebeat.yml
- volumeClaimTemplates:
- - metadata:
- name: volume
- spec:
- accessModes: [ "ReadWriteOnce" ]
- storageClassName: ceph-block
- resources:
- requests:
- storage: 100Gi
- ---
- apiVersion: v1
- kind: Service
- metadata:
- name: [APP]-svc
- namespace: [ENV]
- labels:
- app: [APP]-svc
- spec:
- type: NodePort
- ports:
- - port: 80
- targetPort: 8080
- name: "main"
- selector:
- app: [APP]
- ---
- apiVersion: networking.k8s.io/v1
- kind: Ingress
- metadata:
- name: [APP]-ingress
- namespace: [ENV]
- spec:
- rules:
- - host: [ENV]-[APP].ieasou.cn
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: [APP]-svc
- port:
- number: 8080
- ingressClassName: nginx
- ---
- apiVersion: v1
- kind: ConfigMap
- metadata:
- name: filebeat-config-[APP]
- namespace: [ENV]
- 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
- fields:
- log_topic: [APP]
- fields_under_root: true
- paths:
- - "/data/logs/app/*.log"
- - "/data/logs/*.log"
- output.kafka:
- version: 2.0.0
- enable: true
- hosts: ["kafka-0.kafka-headless.[ENV].svc.cluster.local:9093", "kafka-1.kafka-headless.[ENV].svc.cluster.local:9093", "kafka-2.kafka-headless.[ENV].svc.cluster.local:9093"]
- topic: 'offline-process-topic'
- required_acks: 1
- partition.round_robin:
- reachable_only: false
- compression: gzip
- max_message_bytes: 1000000
|