NOM 代理作为 Daemonset

可以在 Kubernetes 集群中的节点上设置单个 NOM 代理来自动监视 Neo4j 实例,作为 Daemonset。由于代理 Daemonset 需要每个节点的配置,因此可以将其作为文件提供给卷挂载。为了启用 NOM 代理的 Daemonset 部署,一个新的 NOM 代理 Docker 镜像已发布到Docker Hub 验证存储库

代理 Daemon Pod 无法访问 Neo4j Pod 使用的所有资源。例如,对于磁盘使用情况指标,代理需要访问 Neo4j Pod 使用的文件系统或持久卷。这些需要挂载到代理 Daemon Pod。

  1. 以下是 NOM 代理的示例 Daemonset 清单

daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
    name: nom-agent
spec:
    selector:
        matchLabels:
            app: single-instance-agent
    template:
        metadata:
          labels:
            app: single-instance-agent
        spec:
            containers:
              - name: nom-agent
                image: neo4j-ops-manager-agent:latest
                imagePullPolicy: Never
                command: ["console", "-s"]
                env:
                  - name: CONFIG_AGENT_CONFIG_PATH
                    value: "/etc/nom"
                volumeMounts:
                  - name: config
                    mountPath: /etc/nom
            volumes:
                - name: config
                  hostPath:
                    type: Directory
                    path: /deployments/daemonset
            affinity:
                podAffinity:
                    requiredDuringSchedulingIgnoredDuringExecution:
                    - labelSelector:
                        matchExpressions:
                        - key: "helm.neo4j.com/instance"
                          operator: Exists
                      topologyKey: kubernetes.io/hostname
  1. 通过 Helm Chart 部署的简单 Neo4j 实例;

values.yaml
neo4j:
  name: single-instance
  edition: "enterprise"
  password: "passw0rd"
  acceptLicenseAgreement: "yes"
volumes:
  data:
    mode: defaultStorageClass

config:
  metrics.prometheus.enabled: "true"
  metrics.filter: "*"
  1. 一个示例代理配置,从集群节点路径(例如 /deployments/daemonset)挂载到代理 Daemon Pod;

nom-agent-config.yaml
agentName: nom-agent
agentDescription: an agent from helm chart
agentConfigPath: ""
server:
  grpcAddress: server:9090
  httpAddress: https://server:8080
# tls:
#   clientKey: "/path/to/agent/key"
#   clientCert: "/path/to/agent/cert"
instances:
  - name: daemonset-agent
    boltURI: neo4j://localhost:7687
    boltUsername: neo4j
    boltPassword: passw0rd
    queryLogPort: "9500"
    queryLogDisableObfuscation: ""
    logConfigPath: /var/lib/neo4j/conf/server-logs.xml
    queryLogMinDuration: "100"
    queryLogMinDurationFilterErrors: ""