graylog

by KongZ

Helm chartv3.1.2App 7.2.2Verified publisher

Graylog is the centralized log management solution built to open standards for capturing, storing, and enabling real-time analysis of terabytes of machine data.

About this chart

Graylog

This chart provide the [Graylog][1] deployments. Note: It is strongly recommend to use on Official Graylog image to run this chart.

Quick Installation

This chart requires the following charts before install Graylog

  1. MongoDB
  2. Opensearch

Since chart version 2.5.0, we replaced Bitnami MongoDB with the official MongoDB image. You must manually install the MongoDB Operator CRD before installing the Graylog chart with dependencies.

Install MongoDB CRDs only first installation. You can skip CRD step when upgrade.

helm install --create-namespace --namespace graylog community-operator-crds mongodb/community-operator-crds

To install the Graylog Chart with all dependencies

helm install --create-namespace --namespace graylog graylog kongz/graylog

Manually Install Dependencies

This method is recommended when you want to expand the availability, scalability, and security of the services. You need to install MongoDB replicaset and Opensearch with proper settings before install Graylog.

To install MongoDB, run

helm install --create-namespace --namespace graylog community-operator-crds mongodb/community-operator-crds

And then apply the following MongoDBCommunity manifest.

kubectl apply -f <graylog-mongodb.yaml>

The sample configuration for MongoDB setup for Graylog.

apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
  name: graylog-mongodb
spec:
  members: 3
  security:
    authentication:
      modes:
        - SCRAM
  type: ReplicaSet
  users:
    - db: graylog
      name: graylog
      passwordSecretRef:
        name: graylog-mongodb
      roles:
      - db: graylog
        name: readWrite
      - db: graylog
        name: dbAdmin
      - db: admin
        name: clusterMonitor
      scramCredentialsSecretName: graylog
  version: 6.0.25

For complete MongoDB Operator installation separately, see mongodb-kubernetes-operator

Note: There are many alternative MongoDB available on artifacthub.io. If you found the mongodb community operator is not suitable, you can use another MongoDB chart. Modify graylog.mongodb.uri to match your MongoDB endpoint.

You can specify how Graylog picks the MongoDB connection in this order:

  • If graylog.mongodb.uri is specified, it will use this value.
  • If graylog.mongodb.uriSecretKey is specified, it will use the secret graylog.mongodb.uriSecretName.
  • If mongodb.community.install is true and neither graylog.mongodb.uri nor graylog.mongodb.uriSecretKey is used, it will use the secret generated from the MongoDB Operator.

MongoDB roles for an external database

If you bring your own MongoDB (tags.install-mongodb=false), the Graylog user needs more than readWrite. Grant these roles on the existing user (replace grayloguser if your username differs):

RoleDatabaseWhy
readWritegraylogRead and write Graylog application data
dbAdmingraylogRequired from Graylog 7.2: startup runs collMod / convertToCapped on cluster_events. Without this role the pod fails with Unauthorized on collMod
clusterMonitoradminCluster configuration and node stats in the Graylog UI
use graylog
db.grantRolesToUser("grayloguser", [
  { role: "readWrite", db: "graylog" },
  { role: "dbAdmin", db: "graylog" },
  { role: "clusterMonitor", db: "admin" }
])

If the user already has readWrite, you can add the missing roles one at a time:

use graylog
db.grantRolesToUser("grayloguser", [{ role: "clusterMonitor", db: "admin" }])
db.grantRolesToUser("grayloguser", [{ role: "dbAdmin", db: "graylog" }])

Restart Graylog pods after changing roles.

To install Opensearch, run

helm repo add opensearch https://opensearch-project.github.io/helm-charts/

helm install --namespace "graylog" opensearch opensearch/opensearch

The Opensearch installation command above will install all Opensearch nodes types in single node. It is strongly recommend to follow the Opensearch guide to install dedicated node on production.

Note: There are many alternative Opensearch available on artifacthub.io. If you found the stable/opensearch is not suitable, you can search other charts from GitHub repositories.

Install Chart

To install the Graylog Chart into your Kubernetes cluster (This Chart requires persistent volume by default, you may need to create a storage class before install chart.

helm install --namespace "graylog" graylog kongz/graylog \
  --set tags.install-mongodb=false\
  --set tags.install-opensearch=false\
  --set graylog.mongodb.uri=mongodb://mongodb-mongodb-replicaset-0.mongodb-mongodb-replicaset.graylog.svc.cluster.local:27017/graylog?replicaSet=rs0 \
  --set graylog.opensearch.hosts=http://opensearch-cluster-master-headless.graylog.svc.cluster.local:9200

After installation succeeds, you can get a status of Chart

helm status graylog

If you want to delete your Chart, use this command

helm delete graylog

Install Chart with specific Graylog cluster size

By default, this Chart will create a graylog with 2 nodes (1 master, 1 coordinating). If you want to change the cluster size during installation, you can use --set graylog.replicas={value} argument. Or edit values.yaml

For example: Set cluster size to 5

helm install --namespace "graylog" graylog --set graylog.replicas=5 kongz/graylog

The command above will install 1 master and 4 coordinating.

Install Chart with specific node pool

Sometime you may need to deploy your graylog to specific node pool to allocate resources.

Using node selector

For example, you have 6 vms in node pools and you want to deploy graylog to node which labeled as cloud.google.com/gke-nodepool: graylog-pool Set the following values in values.yaml

graylog:
  nodeSelector: { cloud.google.com/gke-nodepool: graylog-pool }

Using tolerations

For example, you have 6 vms in node pools and 3 nodes are tainted with NO_SCHEDULE graylog=true Set the following values in values.yaml

graylog:
  tolerations:
    - key: graylog
      value: "true"
      operator: "Equal"

Configuration

The following table lists the configurable parameters of the Graylog chart and their default values.

ParameterDescriptionDefault
graylog.image.repositorygraylog image repositorygraylog/graylog
graylog.image.taggraylog image tag4.2.7-1
graylog.image.pullPolicyImage pull policyIfNotPresent
graylog.replicasThe number of Graylog instances in the cluster. The chart will automatic create assign master to one of replicas2
graylog.resourcesCPU/Memory resource requests/limitsMemory: 1024Mi, CPU: 500m
graylog.heapSizeOverride Java heap size. If this value empty, chart will allocate heap size using -XX:+UseCGroupMemoryLimitForHeap
graylog.externalUriExternal URI that Graylog is available at
graylog.nodeSelectorGraylog server pod assignment{}
graylog.affinityGraylog server affinity{}
graylog.tolerationsGraylog server tolerations[]
graylog.nodeSelectorGraylog server node selector{}
graylog.envGraylog server env variables{}
graylog.customLabelsGraylog additional labels for statefulset/pods{}
graylog.envRawGraylog server env variables in raw yaml format{}
graylog.podSecurityContextSet security context for defining privilege and accessing control settings entire Pod{}
graylog.securityContextSet security context for defining privilege and accessing control settings for Graylog containerprivileged: false
graylog.javaOptsGraylog service JAVA_OPTS
graylog.additionalJavaOptsGraylog service additional JAVA_OPTS (Replaced with graylog.javaOpts)
graylog.service.typeKubernetes Service typeClusterIP
graylog.service.portGraylog Service port9000
graylog.service.portsGraylog Service extra ports[]
graylog.service.master.enabledIf true, Graylog Master Service will be createdtrue
graylog.service.master.portGraylog Master Service port9000
graylog.service.master.typeGraylog Master Service typeClusterIP
graylog.service.master.annotationsGraylog Master Service annotations{}
graylog.service.headless.suffixIf present, suffix appended to the name of the chart to form the headless service name, ie: -headless would result in graylog-headless
graylog.podAnnotationsKubernetes Pod annotations{}
graylog.priorityClassNameIf specified, indicates the pod's priority.``
graylog.terminationGracePeriodSecondsPod termination grace period120
`graylog.updateS

Deploy graylog with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has graylog on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgraylog is pinned at v3.1.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply