ELK学习笔记(一)——使用K8S部署ElasticSearch8.15.0集群

K8s部署elk(参考) ELFK是Elasticsearch、Logstash、Filebeat、Kibana的简称,是目前最流行的开源日志分析平台。首先,创建一个命名空间来管理ELFK服务:kubectl create namespace elfkkubectl get namespacesapiVersion: apps/v1 kind: Deployment metadata: name: logstash namespace: elfk spec: replicas: 1 selector: matchLabels: ap 阅读详情
AI摘要

本文详细介绍了使用K8S部署ElasticSearch集群的步骤,包括下载镜像、优化宿主机配置、创建工作目录、准备yaml配置文件、生成安全证书等,还阐述了无头服务和有头服务的作用与用途,最后完成ES集群部署并给出检查服务是否成功的方法。

一、下载镜像

#1、下载官方镜像
docker pull elasticsearch:8.15.0
#2、打新tag
docker tag elasticsearch:8.15.0 192.168.9.41:8088/new-erp-common/elasticsearch:8.15.0
#3、推送到私有仓库harbor
docker push 192.168.9.41:8088/new-erp-common/elasticsearch:8.15.0

二、优化宿主机配置

部署elasticsearch集群需要先优化宿主机(所有k8s节点都要优化,不优化会部署失败)

vim /etc/sysctl.conf 

vm.max_map_count=262144 # (用于设置 Linux 系统内核中允许用户态程序的最大内存区域数量。通过设置该参数,可以控制系统中允许映射的内存区域的最大数量,这对于一些需要大量内存映射的应用程序是很有用)

sysctl -p #生效配置

三、创建工作目录

下面是搭建ES的目录一览图
在这里插入图片描述

四、准备yaml配置文件

4.1准备ConfigMap配置

创建ConfigMap配置,里面主要配置了elasticsearch.yml需要的配置

$ cat config-map-es.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-map-es
  namespace: renpho-erp-common
data:
  # 下面2行不确定可不可以删除,但因为在elasticsearch.yml中配置了,所以感觉这2行可以删了
  network.host: "0.0.0.0"
  cluster.name: "es-cluster"
  elasticsearch.yml: |
    #设置集群名称
    cluster.name: es-cluster
    #设置网络访问节点【其他节点修改项】
    network.host: "0.0.0.0"
    #设置网络访问端口
    http.port: 9200
    transport.port: 9300
    node.roles: [ingest,master,data]
    #节点发现
    discovery.seed_hosts: ["elasticsearch-0.elasticsearch.renpho-erp-common.svc.cluster.local","elasticsearch-1.elasticsearch.renpho-erp-common.svc.cluster.local","elasticsearch-2.elasticsearch.renpho-erp-common.svc.cluster.local"]
    #初始化集群
    cluster.initial_master_nodes: ["elasticsearch-0","elasticsearch-1","elasticsearch-2"]
    #启用安全
    xpack.security.enabled: true
    xpack.security.enrollment.enabled: true

    #客户端连接加密
    xpack.security.http.ssl:
      enabled: true
      keystore.path: /usr/share/elasticsearch/config/local-certs/http.p12
      truststore.path: /usr/share/elasticsearch/config/local-certs/http.p12
    #集群内节点连接加密
    xpack.security.transport.ssl:
      enabled: true
      verification_mode: certificate
      keystore.path: /usr/share/elasticsearch/config/local-certs/elastic-certificates.p12
      truststore.path: /usr/share/elasticsearch/config/local-certs/elastic-certificates.p12

    #必须set为true,否则kibana报错
    search.allow_expensive_queries: true
    #禁用geoip下载
    ingest.geoip.downloader.enabled: false

4.2准备Service及StatefulSet文件

在 Kubernetes 上搭建 Elasticsearch 集群时,通常会创建两个不同类型的 Service:一个无头服务(Headless Service)和一个普通的有头服务(ClusterIP Service)。这两种服务各有其特定的用途和作用,以下是它们的具体用途和原因:

a. 无头服务(Headless Service)
  • 作用: 无头服务是通过设置 clusterIP: None 创建的,这意味着它不会分配一个单一的集群IP地址。这种服务不会进行负载均衡,而是直接暴露其背后所有的 Pod。
  • 用途: 在 Elasticsearch 集群中,无头服务通常用于节点发现和集群的状态维护。通过无头服务,每个 Elasticsearch 节点可以获得集群中其他节点的 IP 地址,从而进行节点间的通信和发现。
  • DNS 记录: 无头服务会为每个 Pod 创建一个独立的 DNS A 记录,这样,Elasticsearch 可以通过这些记录直接访问到其他节点。例如,如果有一个无头服务 elasticsearch-headless,且有三个 Pod(elasticsearch-0, elasticsearch-1, elasticsearch-2),这些 Pod 可以通过 DNS 名称 elasticsearch-0.elasticsearch-headless.namespace.svc.cluster.local 访问彼此。
b. 有头服务(ClusterIP Service)
  • 作用: 有头服务(通常称为 ClusterIP 服务)会分配一个集群内部 IP 地址,并为该地址上的端口提供负载均衡。这意味着,任何请求发送到该服务的 IP 地址时,会被分配到后端的某一个 Pod。
  • 用途: 在 Elasticsearch 集群中,有头服务通常用于外部客户端的连接和访问,例如 Kibana 或其他使用者查询 Elasticsearch 数据的应用程序。它可以提供一个单一的访问点,从而简化外部应用的连接配置。
  • 负载均衡: 通过有头服务,Kubernetes 可以在多个 Elasticsearch 节点之间进行负载均衡,确保请求均匀分布,从而提高查询性能和服务的可用性。
c. 总结
  • 无头服务:用于集群内的节点发现和通信,每个节点可以直接找到其他节点的 IP 地址,便于 Elasticsearch 集群中的主节点选举、数据复制和分片分配。
  • 有头服务:用于提供一个稳定的、负载均衡的外部访问点,让外部应用或用户可以通过一个固定的服务 IP 地址来访问 Elasticsearch 集群,而无需关心背后 Pod 的具体 IP。

通过结合使用无头服务和有头服务,可以既保持集群内部节点间的灵活通信,又提供对外部客户端的统一访问接口,这是在 Kubernetes 上部署 Elasticsearch 集群的常见模式。

$ cat deploy-es2.yaml 
#无头服务
apiVersion: v1
kind: Service
metadata:
  name: elasticsearch
  namespace: renpho-erp-common
  labels:
    app: elasticsearch
spec:
  selector:
    app: elasticsearch
  clusterIP: None
  ports:
    - port: 9200
      name: db
    - port: 9300
      name: inter
---
#有头服务
apiVersion: v1
kind: Service
metadata:
  name: es-nodeport
  namespace: renpho-erp-common
  labels:
    app: elasticsearch
spec:
  selector:
    app: elasticsearch
  type: NodePort
  ports:
    - port: 9200
      name: db
      nodePort: 30092
    - port: 9300
      name: inter
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: elasticsearch
  namespace: renpho-erp-common
  labels:
    app: elasticsearch
spec:
  podManagementPolicy: Parallel 
  serviceName: elasticsearch
  replicas: 3
  selector:
    matchLabels:
      app: elasticsearch
  template:
    metadata:
      labels:
        app: elasticsearch
    spec:
      containers:
      - name: elasticsearch
        image: renpho.harbor.com/new-erp-common/elasticsearch:8.15.0
        imagePullPolicy: IfNotPresent
        securityContext: ##开启特权,因为要调整系统内核
          privileged: true
        resources:
          limits:
            cpu: 1
            memory: 2Gi
          requests:
            cpu: 0.5
            memory: 500Mi
       #command: ["/bin/sh","-c"]
       # args:
       # - |
       #   sleep 3600;
        env:
          - name: network.host
            valueFrom:
              configMapKeyRef:
                name: config-map-es
                key: network.host
          - name: node.name
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
        ports:
        - name: db
          containerPort: 9200
          protocol: TCP
        - name: inter
          containerPort: 9300
          protocol: TCP
        volumeMounts:
        - name: elasticsearch-data
          mountPath: /usr/share/elasticsearch/data
          subPath: es-data
        - name: elasticsearch-data
          mountPath: /usr/share/elasticsearch/logs
          subPath: es-logs
        - name: elasticsearch-data
          mountPath: /usr/share/elasticsearch/.cache
          subPath: es-cache
        - name: elasticsearch-data
          mountPath: /usr/share/elasticsearch/plugins
          subPath: es-plugins
        - name: es-cert-file  #挂载存储目录
          mountPath: /usr/share/elasticsearch/config/local-certs
        - name: es-config  #挂载配置文件
          mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
          subPath: elasticsearch.yml
        - name: host-time  #挂载本地时区
          mountPath: /etc/localtime
          readOnly: true

      volumes:
      - name: es-config
        configMap:
          name: config-map-es
          defaultMode: 493 #文件权限为-rwxr-xr-x
      - name: es-cert-file
        secret:
          secretName: es-certificates
      - name: host-time
        hostPath: #挂载本地时区
          path: /etc/localtime
          type: ""
  volumeClaimTemplates:
  - metadata:
      name: elasticsearch-data
    spec:
      storageClassName: ssd-nfs-storage
      accessModes: [ "ReadWriteMany" ]
      resources:
        requests:
          storage: 50Gi

五、生成elastic集群所需的安全证书

为了方便生成证书,可以借助docker 运行 es 容器,但后进入容器内将证书生成好之后,再拷贝到宿主机备用。

##启动es容器
docker run -it -d --name es 192.168.9.41:8088/new-erp-common/elasticsearch:8.15.0
##进入容器生成证书
docker exec -it es bash

elasticsearch@62d07cf8df10:~$ pwd
/usr/share/elasticsearch
5.1生成CA证书
elasticsearch@62d07cf8df10:~$ ./bin/elasticsearch-certutil ca

这里可以选择添加证书密码,如果添加密码的话,后续使用CA证书去生成其他证书都需要先校验密码
默认会在当前目录下(/usr/share/elasticsearch)生成 elastic-stack-ca.p12 这个证书文件,在实际操作中根据自己的实际情况进行调整

5.2使用CA证书生成 transport证书
elasticsearch@62d07cf8df10:~$ ./bin/elasticsearch-certutil cert --ca /usr/share/elasticsearch/elastic-stack-ca.p12

最终会生成1个elastic-certificates.p12的证书文件

5.3使用CA证书生成http证书
elasticsearch@62d07cf8df10:~$ ./bin/elasticsearch-certutil http

## Elasticsearch HTTP Certificate Utility

The 'http' command guides you through the process of generating certificates
for use on the HTTP (Rest) interface for Elasticsearch.

This tool will ask you a number of questions in order to generate the right
set of files for your needs.

## Do you wish to generate a Certificate Signing Request (CSR)?

A CSR is used when you want your certificate to be created by an existing
Certificate Authority (CA) that you do not control (that is, you don't have
access to the keys for that CA). 

If you are in a corporate environment with a central security team, then you
may have an existing Corporate CA that can generate your certificate for you.
Infrastructure within your organisation may already be configured to trust this
CA, so it may be easier for clients to connect to Elasticsearch if you use a
CSR and send that request to the team that controls your CA.

If you choose not to generate a CSR, this tool will generate a new certificate
for you. That certificate will be signed by a CA under your control. This is a
quick and easy way to secure your cluster with TLS, but you will need to
configure all your clients to trust that custom CA.
#是否需要证书认证请求,选n
Generate a CSR? [y/N]n

## Do you have an existing Certificate Authority (CA) key-pair that you wish to use to sign your certificate?

If you have an existing CA certificate and key, then you can use that CA to
sign your new http certificate. This allows you to use the same CA across
multiple Elasticsearch clusters which can make it easier to configure clients,
and may be easier for you to manage.

If you do not have an existing CA, one will be generated for you.
#是否需要选择已存在得证书,选y
Use an existing CA? [y/N]y

## What is the path to your CA?

Please enter the full pathname to the Certificate Authority that you wish to
use for signing your new http certificate. This can be in PKCS#12 (.p12), JKS
(.jks) or PEM (.crt, .key, .pem) format.
#填入已存在ca证书路径
CA Path: /usr/share/elasticsearch/elastic-stack-ca.p12
Reading a PKCS12 keystore requires a password.
It is possible for the keystore's password to be blank,
in which case you can simply press <ENTER> at the prompt
#输入已存在证书密码,没有的话直接回车
Password for elastic-stack-ca.p12:

## How long should your certificates be valid?

Every certificate has an expiry date. When the expiry date is reached clients
will stop trusting your certificate and TLS connections will fail.

Best practice suggests that you should either:
(a) set this to a short duration (90 - 120 days) and have automatic processes
to generate a new certificate before the old one expires, or
(b) set it to a longer duration (3 - 5 years) and then perform a manual update
a few months before it expires.

You may enter the validity period in years (e.g. 3Y), months (e.g. 18M), or days (e.g. 90D)
#证书有效时间
For how long should your certificate be valid? [5y] 7y

## Do you wish to generate one certificate per node?

If you have multiple nodes in your cluster, then you may choose to generate a
separate certificate for each of these nodes. Each certificate will have its
own private key, and will be issued for a specific hostname or IP address.

Alternatively, you may wish to generate a single certificate that is valid
across all the hostnames or addresses in your cluster.

If all of your nodes will be accessed through a single domain
(e.g. node01.es.example.com, node02.es.example.com, etc) then you may find it
simpler to generate one certificate with a wildcard hostname (*.es.example.com)
and use that across all of your nodes.

However, if you do not have a common domain name, and you expect to add
additional nodes to your cluster in the future, then you should generate a
certificate per node so that you can more easily generate new certificates when
you provision new nodes.
#是否每个节点都需要生成,选n,所有节点共用一个
Generate a certificate per node? [y/N]n

## Which hostnames will be used to connect to your nodes?

These hostnames will be added as "DNS" names in the "Subject Alternative Name"
(SAN) field in your certificate.

You should list every hostname and variant that people will use to connect to
your cluster over http.
Do not list IP addresses here, you will be asked to enter them later.

If you wish to use a wildcard certificate (for example *.es.example.com) you
can enter that here.

Enter all the hostnames that you need, one per line.

When you are done, press <ENTER> once more to move on to the next step.
#输入集群所有节点主机名
#使用 Kubernetes 中 Pod 的 DNS 名称,可以避免 Pod IP 变化带来的问题。
#DNS 名称通常是 <pod-name>.<service-name>.<namespace>.svc.cluster.local 形式的
*.elasticsearch.renpho-erp-common.svc.cluster.local
elasticsearch.renpho-erp-common.svc.cluster.local
elasticsearch.renpho-erp-common
elasticsearch

You entered the following hostnames.

 - *.elasticsearch.renpho-erp-common.svc.cluster.local
 - elasticsearch.renpho-erp-common.svc.cluster.local
 - elasticsearch.renpho-erp-common
 - elasticsearch

#是否正确,选y
Is this correct [Y/n]y

#输入集群所有节点ip地址,由于上面使用的是DNS名称,所以这一步不用再输入固定IP地址,直接回车
## Which IP addresses will be used to connect to your nodes?

If your clients will ever connect to your nodes by numeric IP address, then you
can list these as valid IP "Subject Alternative Name" (SAN) fields in your
certificate.

If you do not have fixed IP addresses, or not wish to support direct IP access
to your cluster then you can just press <ENTER> to skip this step.

Enter all the IP addresses that you need, one per line.
When you are done, press <ENTER> once more to move on to the next step.


You did not enter any IP addresses.

#是否正确,选y
Is this correct [Y/n]y

## Other certificate options

The generated certificate will have the following additional configuration
values. These values have been selected based on a combination of the
information you have provided above and secure defaults. You should not need to
change these values unless you have specific requirements.

Key Name: elasticsearch-0.elasticsearch.renpho-erp-common.svc.cluster.local
Subject DN: CN=elasticsearch-0, DC=elasticsearch, DC=renpho-erp-common, DC=svc, DC=cluster, DC=local
Key Size: 2048
#是否修改证书配置,选n
Do you wish to change any of these options? [y/N]n

#输入密码,不想设置密码直接回车。建议为空,省点麻烦,这么多证书认证已经够够的了
## What password do you want for your private key(s)?

Your private key(s) will be stored in a PKCS#12 keystore file named "http.p12".
This type of keystore is always password protected, but it is possible to use a
blank password.

If you wish to use a blank password, simply press <enter> at the prompt below.
Provide a password for the "http.p12" file:  [<ENTER> for none]

## Where should we save the generated files?

A number of files will be generated including your private key(s),
public certificate(s), and sample configuration options for Elastic Stack products.

These files will be included in a single zip archive.

What filename should be used for the output zip file? [/usr/share/elasticsearch/elasticsearch-ssl-http.zip] 
#证书文件保存位置
Zip file written to /usr/share/elasticsearch/elasticsearch-ssl-http.zip


#解压缩刚生成得证书zip文件
elasticsearch@62d07cf8df10:~$ unzip elasticsearch-ssl-http.zip
Archive:  elasticsearch-ssl-http.zip
   creating: elasticsearch/
  inflating: elasticsearch/README.txt
  inflating: elasticsearch/http.p12
...

以上完成后将在/usr/share/elasticsearch下生成一个zip压缩文件。 解压文件,生成一个文件夹,里面包含两个文件夹:
elasticsearch文件夹包含http.p12及elasticsearch.yml的配置参考;
kibana文件夹包含elasticsearch-ca.pem及kibana.yml的配置参考;

5.4生成kibana使用的安全证书

为了方便起见,顺便将kibana使用的安全证书也一起生成。除了之前生成http证书时生成的 elasticsearch-ca.pem 之外还有3个文件

kibana.crt,kibana.key,kibana.csr
下面先生成 kibana.csr,kibana.key

elasticsearch@62d07cf8df10:~$ /usr/share/elasticsearch/bin/elasticsearch-certutil csr -name kibana -dns *.elasticsearch.renpho-erp-common.svc.cluster.local -dns elasticsearch.renpho-erp-common.svc.cluster.local -dns elasticsearch.renpho-erp-common -dns elasticsearch
#执行后默认会生成 csr-bundle.zip
#解压缩后得到kibana.csr ,kibana.key,用它2生成 kibana.crt
elasticsearch@62d07cf8df10:~$ unzip csr-bundle.zip 
Archive:  csr-bundle.zip
   creating: kibana/
  inflating: kibana/kibana.csr       
  inflating: kibana/kibana.key
# 生成crt文件
elasticsearch@62d07cf8df10:~$ cd kibana/
elasticsearch@62d07cf8df10:~$ openssl x509 -req -in kibana.csr -signkey kibana.key -out kibana.crt
Signature ok
subject=CN = kibana
Getting Private key
elasticsearch@62d07cf8df10:~$ ls -l
total 12
-rw-r--r-- 1 elasticsearch elasticsearch  985 Aug 29 08:32 kibana.crt
-rw-r--r-- 1 elasticsearch elasticsearch 1350 Aug 29 08:30 kibana.csr
-rw-r--r-- 1 elasticsearch elasticsearch 1679 Aug 29 08:30 kibana.key
5.4复制容器内证书到宿主机

在这里插入图片描述
另开一个窗口,使用docker cp将容器内上述生成的证书拷贝到宿主机

#在宿主机执行下列命令
##下面的证书拷贝到es的certs中,供es使用
docker cp es:/usr/share/elasticsearch/elastic-stack-ca.p12 /home/ec2-user/k8s/elk/es/certs/elastic-stack-ca.p12
docker cp es:/usr/share/elasticsearch/elastic-certificates.p12 /home/ec2-user/k8s/elk/es/certs/elastic-certificates.p12
docker cp es:/usr/share/elasticsearch/elasticsearch/http.p12 /home/ec2-user/k8s/elk/es/certs/http.p12

##下面的证书拷贝到kibana的certs中,供kibana使用
docker cp es:/usr/share/elasticsearch/kibana/elasticsearch-ca.pem /home/ec2-user/k8s/elk/kibana/certs/elasticsearch-ca.pem
docker cp es:/usr/share/elasticsearch/kibana/kibana.crt /home/ec2-user/k8s/elk/kibana/certs/kibana.crt
docker cp es:/usr/share/elasticsearch/kibana/kibana.csr /home/ec2-user/k8s/elk/kibana/certs/kibana.csr
docker cp es:/usr/share/elasticsearch/kibana/kibana.key /home/ec2-user/k8s/elk/kibana/certs/kibana.key

复制完后,可以将docker容器停掉。

六、开始用K8S部署ES集群

首先,看下es目录下的文件
在这里插入图片描述

6.1将安全证书添加到Secret中
  • elastic-certificates.p12
    • 这个文件是 Elasticsearch 用于节点间加密通信的证书。
  • http.p12
    • 这是 Elasticsearch 用于 HTTP 客户端连接安全访问的证书。
##创建命名空间
kubectl create namespace renpho-erp-common
##执行下列命令创建Secret
kubectl create secret generic es-certificates \
  --from-file=/home/ec2-user/k8s/elk/es/certs/elastic-certificates.p12 \
  --from-file=/home/ec2-user/k8s/elk/es/certs/http.p12 \
  -n renpho-erp-common
##查看Secret
kubectl get secret -n renpho-erp-common

在这里插入图片描述

6.2运行ES集群

依次执行下列命令

#ES配置文件创建
kubectl apply -f config-map-es.yaml
#ES Service,StatefulSet创建
kubectl apply -f delpoy-es2.yaml
#查看运行状态
kubectl get pod -n renpho-erp-common|grep elastic

在这里插入图片描述

浏览器输入:https://192.168.6.220:30092,检查服务是否部署成功
在这里插入图片描述
浏览器输入:192.168.6.220:30092/_cat/nodes?v,检查elasticsearch集群是否正常
在这里插入图片描述
浏览器输入:https://192.168.6.220:30092/_cluster/state/master_node,nodes?pretty,检查elasticsearch集群详情
在这里插入图片描述
到此,使用K8s部署ElasticSearch成功!

部署过程中遇到很多问题,感谢下面博主给出的参考,参考链接

ElasticSearch 8.12.0 K8S部署实践【超详细】【一站式】

Elasticsearch8.11集群部署

k8s集群部署elk
k8s 部署 elk
【k8s部署elasticsearch】k8s环境下安装elasticsearch集群和kibana

k8s-Kubernetes--集群部署 在Docker 作为高级容器引擎快速发展的同时,在Google内部,容器技术已经应用了很多年,Borg系统运行管理着成千上万的容器应用。Kubernetes项目来源于Borg,可以说是集结了Borg设计思想的精华,并且吸收了Borg系统中的经验和教训。Kubernetes对计算资源进行了更高层次的抽象,通过将容器进行细致的组合,将最终的应用服务交给用户。隐藏资源管理和错误处理,用户仅需要关注应用的开发。服务高可用、高可靠。可将负载运行在由成千上万的机器联合而成的集群中。 阅读详情

相关推荐

在kubernetes中部署elasticsearch集群

Elasticsearch是一个分布式可扩展的实时搜索和分析引擎,有restful接口,设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。这里将Elasticsearch集群部署在k8s中,记录部署过程。

Java_fenxiang的博客 1128

k8s安装elasticsearch集群

1 环境简述 搭建es集群需要使用的技术如下:k8s集群、StatefulSet控制器、Service(NodePort)服务、PV、PVC、volumeClaimTemplates(存储卷申请模板)。 StatefulSet控制器创建的Pod适合用于分布式存储系统,它最大的特点是各个Pod的数据不一样,各个Pod无法使用同一个存储卷。注意StatefulSet会给所有的Pod从0开始编号,编号的规则是${statuefulset名称}-${序号}。如果StatefulSet的Pod被误删除,State

make_progress的博客 6247

Kubernetes日志架构选型:为什么EFK替代ELK成为云原生标准

在云原生可观测性体系中,日志采集不是简单的工具堆叠,而是与容器生命周期深度耦合的基础设施能力。Logstash作为JVM进程,其高内存占用、慢启动和静态管道设计,与Kubernetes声明式、轻量化、短暂Pod生命周期的本质存在根本冲突;而Fluentd凭借低资源开销、原生K8s元数据注入(如labels/namespace自动打标)和DaemonSet弹性伸缩能力,成为事实标准的日志采集器。这种架构差异直接决定了EFK在生产环境的稳定性、可维护性与扩展性——它让日志采集从‘中间件’降维为‘平台原语’。本文

407

在k8s中部署Elasticsearch高可用集群详细教程

本文详细介绍了如何在Kubernetes(简称K8s)环境中部署一个高可用的Elasticsearch集群。随着数据量的不断增长,Elasticsearch因其强大的全文搜索和数据分析功能而备受欢迎。然而,如何确保Elasticsearch集群的高可用性、稳定性和可扩展性成为了一个重要议题。本文将从环境准备、配置设计、部署步骤和监控管理等方面全面阐述如何在K8s中构建和运维一个健壮的Elasticsearch集群。

博客虽小,世界尽在其中 1万+

搭建ELK日志采集与分析系统

ELK是Elasticsearch(ES) , Logstash, Kibana的结合,是一个开源日志收集软件。 Elasticsearch:开源分布式搜索引擎,提供搜集、分析、存储数据功能。 Logstash:日志搜集、分析、过滤,支持大量数据获取。其自带输入(input)、过滤语法(grok)、输出(output)三部分。其输入有两种方式:①由各beat采集器输入,经过滤后输出到ES ②本机数据输入,经过滤后输出到ES。Kibana:提供日志分析友好的 Web 界面。本章详细介绍如何搭建elk日志分析系

Linux运维老纪的博客 1793

k8s-实战——(k8s)和日志平台(ELK)

软件版本备注ansible2.9.27docker24.0.7k8s1.30.0kubeadmcontainerd1.7.15helm3.14.4harborv2.9.4cilium1.15.4helm4.10.1helmsonarqube10.5.1helmnfs-client4.0.18helmv7.0.0docker-compose单机版categrafv0.3.55二进制(集群或单机)8.14.2二进制(集群或单机)

北城半夏 475

ELK学习笔记(二)——使用K8S部署Kibana8.15.0

上篇文章我们完成了,ES的集群部署,如果还没有看过上篇文章的兄弟,可以去看看。话不多说,接下来直接进入kibana的搭建。

王一横的个人博客 2586

Jetson Nano系统重装的艺术:从格式化到烧录的深度解析

本文详细解析了Jetson Nano系统重装的完整流程,从SD卡格式化到系统镜像烧录的进阶技巧,包括硬件选择、软件准备、常见问题处理及深度学习环境配置。特别推荐使用三星EVO Plus SD卡和官方电源以确保稳定性,适合开发者快速掌握嵌入式设备系统重装的核心技术。

weixin_28273593的博客 612

ELK学习笔记(三)——使用Filebeat8.15.0收集日志

前面教程已经把ElasticSearch和Kibana部署完毕,接着我们就要使用filebeat去收集我们的java服务日志,这里首先介绍一下ELK和EFK的区别。

王一横的个人博客 2349

vasp算表面吸附流程_VASP表面吸附计算实例分析

本文主要为了记录在学习Vasp计算过程中如何设置INCAR中的一些参数,并不着重讲解其含义,详见可自行到vasp官网查阅。其次关于建模部分也不做细致讨论,一般结构可从Materials Studio里自带的晶体数据库导出,或从三大数据库网站上下载:1、Materaials Project网址:https://materialsproject.org/(强烈推荐,邮箱注册即可使用)2、CCDC网址:...

weixin_39617669的博客 2242

Cesium进阶学习四、shadertoy(着色器)

Cesium进阶学习着色器

程迷学习的博客 4327

Kubernetes (v1.32) 部署 ELK (8.15) 日志系统实战指南

本教程详述了在 Kubernetes (v1.32.13) 集群中部署 ELK (8.15.2) 日志系统的全流程。首先创建 elk 命名空间,利用 StatefulSet 部署 Elasticsearch 并配置持久化存储与资源限制;接着搭建 Kibana 可视化界面连接 ES,并配置 Logstash 作为日志处理管道;同时以 DaemonSet 形式部署轻量级 Filebeat 采集各节点容器日志。最终通过 NodePort 暴露服务并完成全链路验证,成功构建了一套稳定、高效的集中式日志收集与分析平台

专注Linux运维与云原生技术分享。这里是我的技术成长基地,记录从Linux基础命令到Shell脚本,再到Docker、K8s实战的点滴积累。坚持输出干货笔记,希望能帮你避坑排雷,共同在云原生时代进阶! 878

利用Matlab高效处理Comsol仿真数据的可视化技巧

本文详细介绍了如何将Comsol仿真数据高效导入Matlab并进行专业可视化与后处理。核心内容包括正确的数据导出格式设置、三维矩阵重构方法、二维截面与三维体渲染技巧,以及基于Matlab的定量分析与批处理自动化流程,帮助工程师和科研人员深度挖掘仿真数据价值,提升工作效率。

weixin_29065791的博客 363

ES 8.x 系列教程:ES 8.0 服务安装(可能是最详细的ES 8教程)

这可能是最全面的Elasticsearch 8系列教程

Elastic开源社区 2万+

底层软件测试规范,QA评审底层测试

本文首发于【林子的空间】“林子,咱们上次讨论的高效Desk check清单,用起来还挺好的,最近我们组每次Desk check变得顺利多了,Dev也是越来越熟练。”玥玥跟我说。“真好!我们组感觉也是这样!”“不过,我听小慧说他们组有人对QA review UT提出了一些concern(质疑),觉得QA review的价值不大,基本都是Dev给讲一遍,QA也提不出来什么反馈...”玥玥补充说道。“哦...

weixin_42144707的博客 1191

Zemax序列模式下激光二极管(LD)光源建模与像散校正实战

本文详细讲解了在Zemax序列模式下精确建立激光二极管(LD)光源模型并校正其像散的核心方法。通过将椭圆光束的发散角转换为渐晕系数,并巧妙利用理想柱面镜模拟像散,实现了对LD光源特性的高精度模拟。该方法特别适用于激光耦合、激光雷达等需要对像散光束进行精密控制的光学系统设计。

weixin_28455801的博客 443

【kubernetes】集群日志管理 - ELK

ELK是用于对节点内的服务,进行日志收集。 ELK主要组成组件: - Elasticsearch:日志搜索服务,简称 es - Logstash :日志清晰服务 - Kibana :可视化界面 - Filebeat :数据采集 其中,Logstash 占用服务资源较多,一般采用 组件Filebeat 数据采集,交给Logstash进行数据清洗,更加轻量便捷。

meidongyan的博客 880

NX/UG二次开发—CAM—设置程序修剪边界Boundary

最近做了一个设置CAM程序边界的小工具,分享一下经验(官方的代码在文章末尾处),以下均以修剪边界曲线为例。 以下为官方提供的源码: /***************************** Include Files **********************************/ #include <stdlib.h> #include <uf.h> #include <uf_obj.h> #include <uf_object_type

门前大桥下,游过一群鸭,快来看一看,原来是C++ 3741

ELK 9.2.0 安装部署手册

本文档详细介绍了ELK 9.2.0在CentOS 7.9系统上的安装部署流程,主要包括环境准备、系统优化、组件安装和集成配置等内容。首先对系统参数进行了优化调整,包括资源限制、内核参数和防火墙配置。然后分步骤安装Elasticsearch、Kibana和Logstash三大组件,重点说明了Elasticsearch的SSL证书签发、安全配置和账户密码管理。文档提供了详细的配置示例和命令说明,并特别指出由于CentOS 7.9的GLIBC版本限制需要禁用机器学习模块。最后给出了验证安装的方法和后续项目集成指南

12年Java研发经验,从码农到架构师/项目经理。专注技术分享,热爱Linux与开源生态,2023年起扎根长沙。 1231

YOLOv8 智能交通流量监测完整解决方案

YOLOv8智能交通流量监测系统基于先进的目标检测技术,提供实时车辆识别与统计分析功能。该系统通过虚拟检测线实现多方向车流量统计,支持多种车辆类型分类,并具备数据可视化、异常事件预警等核心功能。完整解决方案包含模型训练、实时检测、批量处理、结果分析等模块,并提供Flask API和Docker两种部署方案。系统采用YOLOv8算法实现高效检测,支持GPU加速,可通过量化、剪枝等技术进一步优化性能,为智能交通管理提供可靠的数据支持和技术保障。

u010117029的博客 119

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

使用rancher管理界面在k8s集群搭建ELk

rancher搭建elk、k8s搭建elk

u012911498的博客 1253

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Kubernetes Helm3 部署 ElasticSearch集群 & Kibana 7 & Filebeat 收集展示日志

Kubernetes Helm3 部署 ElasticSearch集群 & Kibana 7 & Filebeat 收集展示日志 一、前言: Elasticsearch 是一个分布式的搜索和分析引擎,可以用于全文检索、结构化检索和分析,并能将这三者结合起来。 Kibana 是一个为 Elasticsearch 平台分析和可视化的开源平台,使用 Kibana 能够搜索、展示存储在 Elasticsearch 中的索引数据。使用它可以很方便用图表、表格、地图展示和分析数据。 Hel

srebro.cn | 运维小弟 1639

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Kubernetes - 学习笔记(一)集群搭建

K8S 笔记1、组件说明(K8s架构)2、Pod概念3、集群安装3.1配置静态 IP3.2 设置系统主机名以及Host文件的相互解析3.3 安装依赖包3.4 设置防火墙为iptables并设置空规则3.5 关闭SELINUX3.6 调整内核3.7 调整系统时区关闭系统不需要的服务3.8 设置rsyslogd和systemd journald3.9 升级系统内核为4.443.10 kube-proxy 开启ipvs的前置条件3.11 安装Docker3.12 安装Kubeadm(主从配置)3.13 初始化节点

xxxLu的博客 350

ELK部署

日志收集的目的:分布式日志数据统一收集,实现集中式查询和管理故障排查安全信息和事件管理报表功能日志收集的价值:日志查询,问题排查,故障恢复,故障自愈应用日志分析,错误报警性能分析,用户行为分析日志收集流程图:日志收集流程1、在k8s集群内部(node、pod、容器)内置filebeat客户端收集日志(日志主要为业务access日志和kubernetes集群的系统日志)2、日志发送给kafka集群,kafka集群进行缓存(削峰填谷)

weixin_58475203的博客 1189

ELASTICSEARCH企业级实战:从下载到集群部署全流程

我经常先在这里测试好配置参数,再应用到正式环境,省去了反复重启本地服务的麻烦。对于需要快速验证技术方案的场景,这种即开即用的体验真的很高效。我遇到过一个坑是没注意JDK版本兼容问题,ELASTICSEARCH 8.x需要JDK17+,而公司测试机还是JDK8,折腾了半天才发现。从下载安装到生产部署踩了不少坑,记录下完整流程和经验,希望能帮到有同样需求的同学。压力测试时发现默认的1GB堆完全不够,调整到8GB后QPS提升3倍。我们用了Ansible批量部署,模板里动态生成每个节点的配置文件。

StarfallRaven13的博客 306

Kubernetes与ELK Stack集成实战:日志管理黄金组合

日志管理是现代分布式系统的核心需求,尤其在云原生环境中更为关键。ELK Stack(Elasticsearch、Logstash、Kibana)作为业界标准的日志解决方案,通过与Kubernetes集成,实现了容器化环境下的高效日志收集与分析。其核心原理在于利用Elasticsearch的分布式存储能力、Logstash的数据处理管道和Kibana的可视化界面。在K8s环境中,DaemonSet模式的日志采集方案因其低资源消耗和无侵入性成为首选,特别适合大规模集群。结合Fluentd和Kafka等技术组件,

weixin_30225755的博客 7
上一篇: ELK学习笔记(四)——如何给Kibana新增用户和角色
下一篇: ELK学习笔记(二)——使用K8S部署Kibana8.15.0
评论 11
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址