Openobserve 云原生观测平台

Openobserve 可观测日志平台

Openobserve 是一个云原生可观测平台(日志、指标、跟踪),可为现实生活日志数据提供大约140倍的存储成本,可以扩展到PB级,比Elasticsearch 相比运营成本更低。

部署
kubectl create ns openobserve
kubectl apply -f 
#下载到本地需要修改storageClassName 的名字
https://raw.githubusercontent.com/zinclabs/openobserve/main/deploy/k8s/statefulset.yaml 
#或者改为ingress 
kubectl -n openobserve port-forward svc/openobserve 5080:5080 --address 0.0.0.0 
使用ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/configuration-snippet: gzip on; gzip_min_length 1024;
      gzip_buffers 16 8k; gzip_comp_level 9; gzip_types text/plain application/x-javascript
      text/css application/xml application/javascript image/jpeg image/gif image/png; gzip_disable "MSIE
      6\.";
    nginx.ingress.kubernetes.io/proxy-body-size: 200m
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"

  name: ingress-persagy
  namespace: paas
spec:
  ingressClassName: nginx
  #tls:
  #  - hosts:
  #      - ${DOMAIN}
  #    secretName: general-tls 
  rules:
  - host: 
    http:
      paths:
      - backend:
          service:
            name: nacos
            port:openobserve
              number: 5080
        path: /
        pathType: ImplementationSpecific
创建StorageClass
创建nfs
kind: Deployment
apiVersion: apps/v1
metadata:
  name: nfs-client-provisioner
  namespace: openobserve 
  labels:
    app: nfs-client-provisioner
spec:
  replicas: 1
  strategy:
    type: Recreate      #---设置升级策略为删除再创建(默认为滚动更新)
  selector:
    matchLabels:
      app: nfs-client-provisioner
  template:
    metadata:
      labels:
        app: nfs-client-provisioner
    spec:
      serviceAccountName: nfs-client-provisioner
      containers:
        - name: nfs-client-provisioner
          #---由于quay.io仓库国内被墙,所以替换成七牛云的仓库
          image: registry.persagy.com/base/nfs-client-provisioner:v4.0.0
          volumeMounts:
            - name: nfs-client-root
              mountPath: /persistentvolumes
          resources:
            limits:
              memory: 2Gi
            requests:
              memory: 1Gi
          env:
            - name: PROVISIONER_NAME
              value: nfs-client     #--- nfs-provisioner的名称,以后设置的storageclass要和这个保持一致
            - name: NFS_SERVER
              value: 172.19.0.31    #---NFS服务器地址,和 valumes 保持一致
            - name: NFS_PATH
              value: /data/application/data/nfs     #---NFS服务器目录,和 valumes 保持一致
      volumes:
        - name: nfs-client-root
          nfs:
            server: 172.19.0.31     #---NFS服务器地址
            path:  /data/application/data/nfs       #---NFS服务器目录
增加RBAC
#### 
vim nfs-rbac.yaml 

kind: ServiceAccount
apiVersion: v1
metadata:
  name: nfs-client-provisioner
  namespace: openobserve
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nfs-client-provisioner-runner
rules:
  - apiGroups: [""]
    resources: ["persistentvolumes"]
    verbs: ["get", "list", "watch", "create", "delete"]
  - apiGroups: [""]
    resources: ["persistentvolumeclaims"]
    verbs: ["get", "list", "watch", "update"]
  - apiGroups: ["storage.k8s.io"]
    resources: ["storageclasses"]
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources: ["events"]
    verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: run-nfs-client-provisioner
subjects:
  - kind: ServiceAccount
    name: nfs-client-provisioner
    namespace: openobserve      
roleRef:
  kind: ClusterRole
  name: nfs-client-provisioner-runner
  apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: leader-locking-nfs-client-provisioner
rules:
  - apiGroups: [""]
    resources: ["endpoints"]
    verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: leader-locking-nfs-client-provisioner
subjects:
  - kind: ServiceAccount
    name: nfs-client-provisioner
    namespace: openobserve
roleRef:
  kind: Role
  name: leader-locking-nfs-client-provisioner
  apiGroup: rbac.authorization.k8s.io
创建sc
vim nfs-sc.yaml 
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: k8s-ops      ##可修改 存储类名称
  annotations:
    storageclass.kubernetes.io/is-default-class: "true" #---设置为默认的storageclass
provisioner: nfs-client    #---动态卷分配者名称,必须和上面创建的"provisioner"变量中设置的Name一致
parameters:
 archiveOnDelete: "true"  #---设置为"false"时删除PVC不会保留数据,"true"则保留数据
测试
IP+端口访问

image-20241212114917404

默认用户名: root@example.com
密码: Complexpass#123
comments powered by Disqus