Graylog没有在Kubernetes上公开Web界面

时间:2019-05-01 11:59:12

标签: docker kubernetes graylog graylog3

我正在与mongoDB和elasticsearch一起在kubernetes中设置Graylog。

这是环境变量中的Graylog规范,我正在传递值。

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

当我这样做

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

状态运行时,它不会进入READY状态。

我尝试了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

在“就绪”探针中,它正在设置一些IP,我已经在环境中尝试了Graylog文档(Click here)中的所有配置,以设置Web界面和所有内容。

1 个答案:

答案 0 :(得分:0)

通过添加

为我工作

我试图将Graylog的版本从2升级到3

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

由于我使用的是旧的环境变量,因此无法正常工作。