📋
k8s use handbook
  • 概述
  • 1. kuberbetes应用接入准则篇
    • 1.1 git分支管理规范
    • 1.2 接入elk字段格式以及约定
    • 1.3 健康检测接口规范
    • 1.4 项目命名规范
  • 2. kubernetes集群部署篇
    • 2.0 kubernetes手动安装概览
      • 201 创建跟证书和秘钥
      • 202 ETCD集群部署及维护
      • 203 kubectl部署以及基本使用
      • 204 Master节点部署及维护
        • 2041 kube-apiserver
        • 2042 kube-scheduler
        • 2043 kube-controller-manager
      • 205 Node节点部署及维护
        • 2051 Flannel部署及维护
        • 2052 kubernetes runtime部署及维护
        • 2053 kubelet
        • 2054 kube-proxy
    • 2.1 kubernetes ansible安装
    • 2.2 kubernetes kubeadm安装
    • 2.3 kubernetes 组件安装
      • 231 coredns
      • 232 kube-dashboard
  • 3. kubernetes权限控制篇
    • 认证
    • 授权
    • 准入机制
  • 4. what happens when k8s .....
    • Kubernetes使用什么方法方法来检查应用程序的运行状况?
    • 如何优雅的关闭pod?
    • TLS bootstrapping 是如何工作的?
    • 怎么编辑kubernetes的yaml文件以及kubernetes的控制是什么样的?
    • deployment如何使用不同的策略部署我们的程序?
    • Kubernetes 如何接收请求,又是如何将结果返回至客户端的?
    • Kubernetes 的调度流程是怎样的?
    • Kubelet 是如何接受调度请求并启动容器的?
    • Kube-proxy 的作用,提供的能力是什么?
    • Kubernetes 控制器是如何工作的?
    • ingress-service-deployment如何关联的?
    • 如何指定pod的运行节点?
    • Https 的通信过程?
  • 5. kubernetes私有仓库篇
  • 6. kubernetes CI/CD篇
    • 5. kubernetes cicd发布流水线
  • 6. kubernetes日志系统篇
    • 6.1 elk使用规范和指南
    • 6.2 kibana搜索简易指南
    • 6.3 基于es api进行查询的注意事项
    • 6.4 集群部署
      • 6.4.1 es规划
        • 索引的生命周期
      • 6.4.2 安装
      • 6.4.3 elasticsearch配置
      • 6.4.4 logstash配置
      • 6.4.5 kibana配置
      • 6.4.6 enable-xpack
        • 6.4.6.1 X-Pack on Elasticsearch
        • 6.4.6.2 X-Pack on Logstash
        • 6.4.6.3 X-Pack on Kibana
        • 6.4.6.4 xpack破解
        • 6.4.6.5 LDAP user authentication
      • 6.4.7 Cerebro configuration
      • 6.4.8 Curator configuration
    • 6.10 备份恢复
  • 7.0 kuberbetes服务暴露Ingress篇
    • 7.1 Ingress规划
    • 7.2 Traefik ingress controller
      • 7.2.1 Traefik配置详解
      • 7.2.2 Traefik部署
      • 7.2.3 分场景使用示例
      • 7.2.4 Traefik功能示例
      • 7.2.5 Traefik日志收集
      • 7.2.6 https证书更新
    • 7.3 Nginx ingress controller
      • 7.3.1 Nginx 配置详解
      • 7.3.2 Nginx 部署
      • 7.3.3 使用示例
    • 7.4 ingress日常运维
  • 8.0 kubernetes监控篇
    • 8.1 prometheus非k8s部署
    • 8.2 prometheusk8s部署
    • 8.3 prometheus 配置文件详解
    • 8.3 prometheus alertmanager
  • 9.0 kubernetes配置管理篇
  • 10.0 权威DNS篇
    • 10.1 PowerDNS安装部署
    • 10.1 PowerDNS zone设置
由 GitBook 提供支持
在本页
  • 基础信息准备
  • 维护ansible hosts文件
  • 安装jdk
  • 安装Elasticsearch
  • Download and install the RPM manually
  • Download and install the Debian package manually
  • Running Elasticsearch with systemd
  • 安装Logstash
  • Running Logstash with systemd
  • 部署Kibana
  • Download and install the RPM manually
  • Running Kibana with systemd
  • 安装Cerebro
  • Download and install the RPM manually
  • Running Cerebro with systemd
  • 安装Curator
  • Repository Configuration
  • Binary Package Installation

这有帮助吗?

  1. 6. kubernetes日志系统篇
  2. 6.4 集群部署

6.4.2 安装

上一页索引的生命周期下一页6.4.3 elasticsearch配置

最后更新于5年前

这有帮助吗?

下面文档为基础的部署步骤, 后续请使用ansible进行部署

基础信息准备

由于ELK组建的更新换代速度很快, 请参考中的有关信息确定安装的具体版本

集群基本信息

es_version: 6.5.1 
jkd_version: 8 
es_cluster_name: welog

主机资源信息

IP

角色

生命周期角色

部署程序

10.40.58.153

master、data、client

hot

es logstash

10.40.58.154

master、data、client

cold

es kibana

10.40.61.116

master、data、client

cold

es cerebro curator

维护ansible hosts文件

➜ cat hosts

[elasticsearch-master]
py-modelo2o08cn-p003.pek3.example.net ansible_host=10.40.58.153

[elasticsearch-datanode]
py-modelo2o08cn-p004.pek3.example.net ansible_host=10.40.58.154
py-modelaud05cn-p005.pek3.example.net ansible_host=10.40.58.116

[logstash]
py-modelo2o08cn-p003.pek3.example.net ansible_host=10.40.58.153

[kibana]
py-modelo2o08cn-p004.pek3.example.net ansible_host=10.40.58.154

[kibana]
py-modelaud05cn-p005.pek3.example.net ansible_host=10.40.58.116

[curator]
py-modelaud05cn-p005.pek3.example.net ansible_host=10.40.58.116

安装jdk

Logstash Elasticsearch 需要JDK8, 需要检查主机上是否已经安装JDK8

[root@py-modelo2o08cn-p003 ~]# java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

安装Elasticsearch

Download and install the RPM manually

The RPM for Elasticsearch v7.4.2 can be downloaded from the website and installed as follows:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-7.4.2-x86_64.rpm.sha512 
sudo rpm --install elasticsearch-7.4.2-x86_64.rpm

Download and install the Debian package manually

The Debian package for Elasticsearch v7.4.2 can be downloaded from the website and installed as follows:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-amd64.deb
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-amd64.deb.sha512
shasum -a 512 -c elasticsearch-7.4.2-amd64.deb.sha512 
sudo dpkg -i elasticsearch-7.4.2-amd64.deb

Running Elasticsearch with systemd

To configure Elasticsearch to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

Elasticsearch can be started and stopped as follows:

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

These commands provide no feedback as to whether Elasticsearch was started successfully or not. Instead, this information will be written in the log files located in /var/log/elasticsearch/.

By default the Elasticsearch service doesn’t log information in the systemd journal. To enable journalctl logging, the --quiet option must be removed from the ExecStart command line in the elasticsearch.service file.

When systemd logging is enabled, the logging information are available using the journalctl commands:

To tail the journal:

sudo journalctl -f

To list journal entries for the elasticsearch service:

sudo journalctl --unit elasticsearch

To list journal entries for the elasticsearch service starting from a given time:

sudo journalctl --unit elasticsearch --since  "2016-10-30 18:17:16"

安装Logstash

YUM 方式安装

Download and install the public signing key:

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Add the following in your /etc/yum.repos.d/ directory in a file with a .repo suffix, for example logstash.repo

[logstash-6.x]
name=Elastic repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

And your repository is ready for use. You can install it with:

sudo yum install logstash

Running Logstash with systemd

To configure Logstash to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable logstash.service

Logstash can be started and stopped as follows:

sudo systemctl start logstash.service
sudo systemctl stop logstash.service

部署Kibana

Download and install the RPM manually

The RPM for Kibana v6.5.4 can be downloaded from the website and installed as follows:

wget https://artifacts.elastic.co/downloads/kibana/kibana-6.5.4-x86_64.rpm
shasum -a 512 kibana-6.5.4-x86_64.rpm 
sudo rpm --install kibana-6.5.4-x86_64.rpm

Running Kibana with systemd

To configure Kibana to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable kibana.service

Kibana can be started and stopped as follows:

sudo systemctl start kibana.service
sudo systemctl stop kibana.service

These commands provide no feedback as to whether Kibana was started successfully or not. Instead, this information will be written in the log files located in /var/log/kibana/.

安装Cerebro

Download and install the RPM manually

rpm 包从github上进行下载, 操作命令如下:

wget https://github.com/lmenezes/cerebro/releases/download/v0.8.5/cerebro-0.8.5-1.noarch.rpm 
rpm --install cerebro-0.8.5-1.noarch.rpm

Running Cerebro with systemd

To configure cerebro to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable cerebro.service

cerebro can be started and stopped as follows:

sudo systemctl start cerebro.service
sudo systemctl stop cerebro.service

安装Curator

  • curator是一个用于管理es中的索引和快照的工具。

  • curator是用Python写的,可以作为命令行工具,也能作为python的API。

Repository Configuration

Add the following in your /etc/yum.repos.d/ directory in a file with a .repo suffix, for example curator.repo

The repositories are different for CentOS/RHEL 6 and 7 due to library and path differences. Be sure to use the correct version for your system!

RHEL/CentOS 6:

[curator-5]
name=CentOS/RHEL 6 repository for Elasticsearch Curator 5.x packages
baseurl=https://packages.elastic.co/curator/5/centos/6
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

RHEL/CentOS 7:

[curator-5]
name=CentOS/RHEL 7 repository for Elasticsearch Curator 5.x packages
baseurl=https://packages.elastic.co/curator/5/centos/7
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

The RPM version of Curator is a binary version. What this really means is that the source is frozen, and all required libraries are bundled with the curator binary, so there are no conflicts.

There are separate binary packages for RedHat variants. The binary packages resulting from the creation process have been tested on CentOS 6 & 7, with a different binary for each. They may work on similar variants and/or derivatives, but they have not been tested.

yum install elasticsearch-curator

This will install the necessary files into /opt/elasticsearch-curator and make a symlink at /usr/bin/curator that points to the curator binary in the aforementioned directory.

安装部署请参照查找对应的版本, 下面片段为官方网站

Check man journalctl or for more command line options.

详细查看官方文档

更多的安装步骤请查看官方文档

cerebro支持节点状态监控 服务器磁盘空间,cpu,load,索引数量大小 ,数据分布位置等监控。 支持查询。项目托管于

安装Elasticsearch
安装Logstash
部署Kibana
安装Cerebro
安装Curator
官方文档
官方文档
https://www.freedesktop.org/software/systemd/man/journalctl.html
Install Logstash
Install Kibana
github
github
官方网站
Binary Package Installation