我尝试使用官方页面
但没成功。生成的 pod 均未成功运行,我也无法获取任何 pod 的日志。我使用的是 Rancher v1.29.4+rke2r1。

docs.crowdsec.net 上有一个指向此页面的链接:
这两个页面(docs.crowdsec.net 和 artifacthub.io)包含截然不同的“基本”配置,这令人困惑。例如,一个页面希望我使用 Traefik,而另一个页面则不希望我使用。

在artifact.io页面上,同一个yaml文件中的一个代码块有,password: ${DB_PASSWORD}而另一个代码块有dbPassword: <externalDbPassword>。为什么会这样?这种差异是否有技术原因,还是两个人在一段时间内对同一网页进行了编辑而没有阅读原始页面?也许这个页面是自动生成的或由脚本更新的。

无论如何,我正在寻求有关使用哪个页面的建议。我显然不是 Kubernetes 专家,所以我很难决定。

谢谢。下面添加我的部署 yaml。结果 pod 均未启动。

config:
  config.yaml.local: |
    db_config:
      type:     postgresql
      user:     crowdsec
      password: ${DB_PASSWORD}
      db_name:  crowdsec
      host:     192.168.10.132
      port:     5432
      sslmode:  require

agent:
  acquisition:
    - namespace: "crowdsec"       # Specify the namespace for the pods you want to monitor
      podName: "crowdsec-wutwut"      # Specify the pod name or pattern
      program: "/var/log/pods/*.log"  # Specify the log file path or a pattern to match
  resources:
    requests:
      cpu: "100m"  # Lower the CPU request
      memory: "128Mi"  # Lower memory if needed
    limits:
      cpu: "500m"  # Set a reasonable CPU limit
      memory: "256Mi"
  replicaCount: 1

lapi:
  # 2 or more replicas for HA
  resources:
    requests:
      cpu: "100m"  # Lower CPU request for LAPI
      memory: "128Mi"
    limits:
      cpu: "500m"
      memory: "256Mi"
  replicas: 2
  # You can specify your own CS_LAPI_SECRET, or let the chart generate one. Length must be >= 64
  secrets:
    csLapiSecret: <t0iL3tj_sKw1dB@iT>
  # Specify your external DB password here
  extraSecrets:
    dbPassword: <F6-pxY8[l\_%*4d>
  persistentVolume:
    # When replicas for LAPI is greater than 1, two options, persistent volumes must be disabled, or in ReadWriteMany mode
    config:
      enabled: false
    # data volume is not required, since SQLite isn't used
    data:
      enabled: false
  # DB Password passed through environment variable
  env:
    - name: DB_PASSWORD
      valueFrom:
        secretKeyRef:
          name: crowdsec-lapi-secrets
          key: dbPassword

当我跑步的时候,

kubectl -n crowdsec logs crowdsec-lapi-5cc7bf9b5-zjtwv

错误是:

Generate local agent credentials
level=fatal msg="failed to connect to database: failed creating schema resources: querying server version failed to connect to `host=192.168.10.132 user=crowdsec database=crowdsec`: failed SASL auth (FATAL: password authentication failed for user \"crowdsec\" (SQLSTATE 28P01))"

我无法判断 pod 是否正在尝试创建数据库。crowdsec 数据库已经存在,而这些不是我实际的密码或机密。

1

  • 我刚刚尝试使用工件配方并看到这些错误。我不知道这些应该放在 yaml 的哪个位置。错误:安装失败:值不符合以下图表中架构的规范:crowdsec:- agent.acquisition.0.namespace:字符串长度必须大于或等于 1 – agent.acquisition.0.podName:字符串长度必须大于或等于 1 – agent.acquisition.0.program:字符串长度必须大于或等于 1


    – 

0