0

我正在 kubernetes 中设置 graylog 以及 mongoDB 和 elasticsearch。

这是我正在传递值的环境变量中 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 文档(单击此处)的所有配置,以设置 Web 界面和所有内容。

4

1 回答 1

0

通过添加对我有用

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

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

由于我使用的是旧的环境变量,它不起作用。

于 2019-08-20T06:43:31.060 回答