NOM agent as a Daemonset

A single NOM agent to monitor Neo4j instances on a Node in Kubernetes cluster can be setup automatically as a Daemonset. Since agent Daemonset requires per Node configuration, it can be provided as a file on a volume mount. To enable Daemonset deployments of NOM agents, a new NOM agent Docker image is published to Docker Hub verified repository.

An agent Daemon pod can not access all resources that Neo4j pod uses. For example, for disk usage metrics, agent needs access to file system or persistent volumes that Neo4j pod uses. These need to be mounted to agent Daemon pod.

  1. Following is a sample daemonset manifest for NOM agent:

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. A simple Neo4j instance deployed through helm charts;

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

config:
  metrics.prometheus.enabled: "true"
  metrics.filter: "*"
  1. A sample agent config to mount on agent Daemon pod from cluster node path (eg. /deployments/daemonset);

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: ""