1

我安装了一个 Elasticsearch 7.6 集群,基于

https://github.com/openstack/openstack-helm-infra/tree/master/elasticsearch

以下是我为启用安全性所做的工作:生成证书

./bin/elasticsearch-certutil ca
File location: /usr/share/elasticsearch/elastic-stack-ca.p12

./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
File location: /usr/share/elasticsearch/elastic-certificates.p12

kubectl create secret generic elastic-certificates --from-file=elastic-certificates.p12

湾。为 master pod 启用 statefulset 上的安全性

kubectl edit statefulset elasticsearch-master
 ----
    - name: xpack.security.enabled
      value: "true"
    - name: xpack.security.transport.ssl.enabled
      value: "true"
    - name: xpack.security.transport.ssl.verification_mode
      value: certificate
    - name: xpack.security.transport.ssl.keystore.path
      value: /usr/share/elasticsearch/config/certs/elastic-certificates.p12
    - name: xpack.security.transport.ssl.truststore.path
      value: /usr/share/elasticsearch/config/certs/elastic-certificates.p12
----
    - mountPath: /usr/share/elasticsearch/config/certs
      name: elastic-certificates
      readOnly: true
----
  - name: elastic-certificates
    secret:
      defaultMode: 444
      secretName: elastic-certificates

C。为数据 pod 启用 statefulset 安全性

kubectl edit statefulset elasticsearch-data

----
    - name: xpack.security.enabled
      value: "true"
    - name: xpack.security.transport.ssl.enabled
      value: "true"
    - name: xpack.security.transport.ssl.verification_mode
      value: certificate
----
    - mountPath: /usr/share/elasticsearch/config/certs
      name: elastic-certificates
----
  - name: elastic-certificates
    secret:
      defaultMode: 444
      secretName: elastic-certificates

d。为客户端启用部署安全性

kubectl edit deployment elasticsearch-client

----
    - name: xpack.security.enabled
      value: "true"
    - name: xpack.security.transport.ssl.enabled
      value: "true"
    - name: xpack.security.transport.ssl.verification_mode
      value: certificate
    - name: xpack.security.transport.ssl.keystore.path
      value: /usr/share/elasticsearch/config/certs/elastic-certificates.p12
    - name: xpack.security.transport.ssl.truststore.path
      value: /usr/share/elasticsearch/config/certs/elastic-certificates.p12
----
    - mountPath: /usr/share/elasticsearch/config/certs
      name: elastic-certificates
----
  - name: elastic-certificates
    secret:
      defaultMode: 444
      secretName: elastic-certificates

重新启动 Pod 后,我遇到了以下问题:

一个。数据罐卡在初始化阶段

kubectl get pod |grep data
elasticsearch-data-0                                  1/1     Running     0          42m
elasticsearch-data-1                                  0/1     Init:0/3    0          10m
kubectl logs elasticsearch-data-1 -c init |tail -1
Entrypoint WARNING: <date/time> entrypoint.go:72: Resolving dependency Service elasticsearch-logging in namespace osh-infra failed: Service elasticsearch-logging has no endpoints .

湾。有关连接被拒绝的客户端 pod 错误

Warning  Unhealthy  18m (x4 over 19m)     kubelet, s1-worker-2  Readiness probe failed: Get http://192.180.71.82:9200/_cluster/health: dial tcp 192.180.71.82:9200: connect: connection refused
Warning  Unhealthy  4m17s (x86 over 18m)  kubelet, s1-worker-2  Readiness probe failed: HTTP probe failed with statuscode: 401

C。服务“elasticsearch-logging”端点为空

任何建议如何解决或有什么问题?谢谢。

4

0 回答 0