Graylog not exposing webinterface on kubernetes

5/1/2019

I am setting up graylog in kubernetes along with mongoDB and elasticsearch.

Here is specifications of graylog in environment variable i am passing values.

spec:
          terminationGracePeriodSeconds: 70
          initContainers:
          - name: set-dir-owner
            image: busybox:1.29.2
            securityContext:
              privileged: true
            command: ['sh', '-c' ,'chown -R 1100:1100 /usr/share/graylog/data/journal', 'chmod 777 /usr/share/graylog/data/journal//graylog2-committed-read-offset', 'chmod g+rwx /usr/share/graylog/data/journal//graylog2-committed-read-offset', 'chgrp 1100 /usr/share/graylog/data/journal/graylog2-committed-read-offset', 'chown -R 1100:1100 ./graylog_journal', 'chown -R 1100:1100 /usr/share/graylog/data/journal', 'chown -R 1100:1100 /usr/share/graylog/data/journal/graylog2-committed-read-offset']
            volumeMounts:
            - name: graylog-persistent-storage
              mountPath: /usr/share/graylog/data/journal
          containers:
            - name: graylog-master
              image: "graylog/graylog:3.0"
              securityContext:
                privileged: true
                runAsUser: 1100
              env:
              - name: GRAYLOG_PASSWORD_SECRET
                value: {{required "A valid .Values.graylog.passwordSecret entry required!" .Values.graylog.passwordSecret }}
              - name: GRAYLOG_ROOT_PASSWORD_SHA2
                value: {{ .Values.graylog.passwordSecret | sha256sum }}
              - name: GRAYLOG_MONGODB_URI
                value: "mongodb://{{ $mongodbServiceName }}-0.{{ $mongodbServiceName }}:27017/graylog?replicaSet=rs0"
              - name: GRAYLOG_IS_MASTER
                value: "true"
              - name: GRAYLOG_ELASTICSEARCH_DISCOVERY_ZEN_PING_UNICAST_HOSTS
                value: "{{ $elasticsearchServiceName }}-0.{{ $elasticsearchServiceName }}:9300"
              - name: GRAYLOG_ELASTICSEARCH_HOSTS
                value: "http://{{ $elasticsearchServiceName }}-0.{{ $elasticsearchServiceName }}:9200"
              - name: GRAYLOG_WEB_LISTEN_URI
                value: "{{ $externalProtocol }}s://{{ .Release.Name }}.{{ $externalDomain }}{{ if not .Values.ingress.enabled }}:31300{{ end }}"
              - name: GRAYLOG_REST_LISTEN_URI
                value: "{{ $externalProtocol }}s://{{ .Release.Name }}.{{ $externalDomain }}{{ if not .Values.ingress.enabled }}:31300{{ end }}/api"
              - name: GRAYLOG_HTTP_PUBLISH_URI  
                value: "{{ $externalProtocol }}s://{{ .Release.Name }}.{{ $externalDomain }}{{ if not .Values.ingress.enabled }}:31300{{ end }}"
              - name: GRAYLOG_HTTP_EXTERNAL_URI  
                value: "{{ $externalProtocol }}s://{{ .Release.Name }}.{{ $externalDomain }}{{ if not .Values.ingress.enabled }}:31300{{ end }}/"
              - name: GRAYLOG_WEB_ENDPOINT_URI
                value: "{{ $externalProtocol }}s://{{ .Release.Name }}.{{ $externalDomain }}{{ if not .Values.ingress.enabled }}:31300{{ end }}"
              - name: GRAYLOG_SERVER_JAVA_OPTS
                value: "-Xms1g -Xmx1g -XX:NewRatio=1 -XX:MaxMetaspaceSize=256m -server -XX:+ResizeTLAB -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:-OmitStackTraceInFastThrow"
              ports:
              - containerPort: {{ .Values.graylog.web.service.internalPort }}
                name: http
              - containerPort: 12201
                name: udp-input
              - containerPort: 1514
                name: tcp-input
              volumeMounts:
              - name: graylog-persistent-storage
                mountPath: /usr/share/graylog/data/journal
                subPath: graylog
              resources:
    {{ toYaml .Values.graylog.master.containers.resources | indent 12 }}
              readinessProbe:
                httpGet:
                  path: /api/system/lbstatus
                  port: {{ .Values.graylog.web.service.internalPort }}
                initialDelaySeconds: 30
                periodSeconds: 3
                timeoutSeconds: 3
                successThreshold: 1
                failureThreshold: 4

When i do

kubectl get pods

NAME                                READY   STATUS    RESTARTS   AGE
test-logs-graylog-elasticsearch-0   1/1     Running   0          4m
test-logs-graylog-master-0          0/1     Running   0          4m
test-logs-graylog-slave-0           0/1     Running   0          4m
test-logs-mongodb-replicaset-0      1/1     Running   0          4m

It is not coming in READY state while status is running.

I tried kubectl describe pod test-logs-graylog-master-0

Normal   Started                 18m                    kubelet, gke-wotnot-staging-cluster-pool-1-3420ace9-s7sn  Started container
  Warning  Unhealthy               3m49s (x290 over 18m)  kubelet, gke-wotnot-staging-cluster-pool-1-3420ace9-s7sn  Readiness probe failed: Get http://10.8.3.86:9000/api/system/lbstatus: dial tcp 10.8.3.86:9000: connect: connection refused

In Readiness probe it is setting up some IP and i have tried all the config from graylog document (Click here) in an environment to set web interface and everything.

-- Harsh Manvar
docker
graylog
graylog3
kubernetes

1 Answer

8/20/2019

it's work for me by adding

i was trying to upgrade the version of graylog from 2 to 3

- name: GRAYLOG_HTTP_BIND_ADDRESS
          value: 0.0.0.0:9000
        - name: GRAYLOG_HTTP_EXTERNAL_URI
          value: https://example.io/

due to i was using the old environment variables it was not working.

-- Harsh Manvar
Source: StackOverflow