十五、K8s helm包管理与应用
Helm包管理:前面我们在使用 wordpress+MySQL 部署博客应用的时候,需要做许多的工作,需要每个 pod创建 pv 和 pvc,然后分别创建每个应用的 pod 及 svc,整个过程非常的麻烦。如果搭建博客所有步骤作为一个整体,放在一个文件夹里(叫做 chart),以后我们直接使用这个 chart 就可以把所有的操作一次性做完,这样很容易实现了一个博客应用(chart 的一个实例,叫做
Helm包管理:
前面我们在使用 wordpress+MySQL 部署博客应用的时候,需要做许多的工作,需要每个 pod创建 pv 和 pvc,然后分别创建每个应用的 pod 及 svc,整个过程非常的麻烦。
如果搭建博客所有步骤作为一个整体,放在一个文件夹里(叫做 chart),以后我们直接使用这个 chart 就可以把所有的操作一次性做完,这样很容易实现了一个博客应用(chart 的一个实例,叫做 release),就非常的方便了。这个就类似于我们用虚拟机模板去克隆出来一台台的虚拟机,这样就省的在一台台的去安装了,这个模板就是 chart,克隆出来的虚拟机就是 release。
helm 实现的就是这样的功能,在互联网上存在 chart 仓库(也可以自己搭建)包括了各种应用,我们需要什么应用直接拉取部署即可。
相关术语:
Charts:
也就是Heml中的程序包,包括了一个Kubernetes应用程序所运行时的镜像、依赖关系、资源定义文件等;
Repository:
Charts仓库,用于集中存储和分布Charts,类似于docker镜像仓库Hubor/Regestry,Git中的Gitlab/Github,Maven中的Nexus之类的仓库中心。
Config:
应用程序安装运行时的配置信息;
Release:
应用程序实例化配置后运行于Kubernetes集群中的一个Charts实例。在一个k8s集群中一个Charts可以指定不同Config多次安装,每次安装都会创建一个新的Release。
Helm架构:
在 helm 2.X 版本的时候,helm 是一种 C/S 结构的应用,包括 helm 客户端和 tiller 服务器端,用户通过 helm 客户端向 tiller 服务端发送部署请求,tiller 服务端和 kubernetes 的 apiserver进行交互然后部署。
Helm主要由Helm客户端、Tiller服务端和Charts仓库组成:
Helm Client是命令行工具,基于gRPC协议与Timer Server交互,主要完成以下任务:
- 在本地开发Charts;
- 管理Charts仓库;
- 提供了安装、查找、卸载的命令与Tiller交互完成安装、查找、卸载Charts。
Tiller Server是运行于Kubernetes集群之上容器化服务应用,它接收来自Helm Client的请求,与Kubernates API Server进行交互,主要完成以下任务:
- 监听Heml Client过来的请求;
- 合并Charts与Config后构建一个Release;
- 向Kubernetes集群安装Charts并对相应的Release进行跟踪;
- 升级和卸载Charts。
现在新版 helm v3.X 里,已经没有 tiller 端了,操作起来也大大的简化了。
相关链接:https://blog.csdn.net/isaiah282485068/article/details/89293181
实验环境:
按照图示部署好了K8s集群,一个Master,两个worker nodes。
一、安装Helm
下载最新版的 helm,下载地址 https://github.com/helm/helm/releases;下载安装脚本:https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
下载完成后给安装脚本加上运行权限chmod +x get。因为我们已经下载的 helm 版本是 v3.2.1 版本,所以先修改 get 文件直接指定 helm 的版本为 v3.2.1。在checkDesiredVersion 函数,改为下面内容:
# checkDesiredVersion checks if the desired version is available.
checkDesiredVersion() {
TAG=v3.2.1
}
downloadFile 函数里,删除并插入 cp helm* $HELM_TMP_ROOT,结果如下:
# downloadFile downloads the latest binary package and also the checksum
# for that binary.
downloadFile() {
HELM_DIST="helm-$TAG-$OS-$ARCH.tar.gz"
DOWNLOAD_URL="https://get.helm.sh/$HELM_DIST"
CHECKSUM_URL="$DOWNLOAD_URL.sha256"
HELM_TMP_ROOT="$(mktemp -dt helm-installer-XXXXXX)"
HELM_TMP_FILE="$HELM_TMP_ROOT/$HELM_DIST"
HELM_SUM_FILE="$HELM_TMP_ROOT/$HELM_DIST.sha256"
echo "Downloading $DOWNLOAD_URL"
cp helm* $HELM_TMP_ROOT
}
开始的verifyChecksum函数里,把其中一部分行注释掉:
# verifyChecksum verifies the SHA256 checksum of the binary package.
verifyChecksum() {
printf "Verifying checksum... "
local sum=$(openssl sha1 -sha256 ${HELM_TMP_FILE} | awk '{print $2}')
local expected_sum=$(cat ${HELM_SUM_FILE})
echo "Done."
}
执行脚本,安装helm:
[root@vms201 helm]# ./get
安装成功后,有提示说明helm安装到了/usr/local/bin/helm中。有一个问题是helm无法使用table键补全,修改如下的文件:
vim /etc/profile
在开头加上如下字段:
source <(helm completion bash)
并且source一下文件即可:
[root@vms201 helm]# source /etc/profile
现在便可以查看helm的 version了:
[root@vms201 helm]# helm version
version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}
二、安装helm的仓库
添加仓库的语法:
helm repo add 名称 地址
删除仓库的语法:
helm repo rm 名称
使用阿里云的源,名称为为ali:
[root@vms201 helm]# helm repo add ali https://apphub.aliyuncs.com
"ali" has been added to your repositories
查看正则使用的源:
[root@vms201 helm]# helm repo list
NAME URL
ali https://apphub.aliyuncs.com
三、部署Msql应用
部署mysql,搜索需要使用的chart:
[root@vms201 helm]# helm search repo mysql
NAME CHART VERSION APP VERSION DESCRIPTION
ali/mysql 6.8.0 8.0.19 Chart to create a Highly available MySQL cluster
ali/mysqldump 2.6.0 2.4.1 A Helm chart to help backup MySQL databases usi...
ali/mysqlha 1.0.0 5.7.13 MySQL cluster with a single master and zero or ...
ali/prometheus-mysql-exporter 0.5.2 v0.11.0 A Helm chart for prometheus mysql exporter with...
ali/percona 1.2.0 5.7.17 free, fully compatible, enhanced, open source d...
ali/percona-xtradb-cluster 1.0.3 5.7.19 free, fully compatible, enhanced, open source d...
ali/phpmyadmin 4.2.12 5.0.1 phpMyAdmin is an mysql administration frontend
ali/mariadb 7.3.9 10.3.22 Fast, reliable, scalable, and easy to use open-...
ali/mariadb-galera 0.8.1 10.4.12 MariaDB Galera is a multi-master database clust...
下载chart并解压:
[root@vms201 helm]# helm pull ali/mysql
[root@vms201 helm]# tar zxvf mysql-6.8.0.tgz
进入解压出来的目录,编辑values.yaml文件,可以修使用的镜像和版本、是否需要复制、是否需要探测、是否需要持久性存储等、设置mysql的账号密码信息等。可以选择性的关闭一些不必要的功能。
安装语法:
helm install 名字 chart 目录
helm install db .
查看现在已经部署的 release 及 pod和svc:
[root@vms201 mysql]# helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
db helm 1 2021-07-11 12:27:35.489168723 +0800 CST deployed mysql-6.8.0 8.0.19
[root@vms201 mysql]# kubectl get pods
NAME READY STATUS RESTARTS AGE
db-mysql-master-0 1/1 Running 0 54s
[root@vms201 mysql]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
db-mysql ClusterIP 10.111.242.45 <none> 3306/TCP 3m26s
下载mysql客户端,并使用修改的账号密码登陆mysqldb中:IP地址为对应SVC的10.111.242.45地址。
[root@vms201 mysql]# mysql -uroot -pmysql1 -h10.111.242.45
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.25 Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]>
删除掉部署的chart:
[root@vms201 mysql]# helm del db
release "db" uninstalled
四、搭建私有源
为了方便部署helm,可以搭建私有源,存放chart的相关信息,加速搭建过程。
在VMS203这个worker上用 nginx 镜像创建一个容器,作为私有源:注意卷的映射。
[root@vms203 ~]# docker run -dit --name=web1 --restart=always -p 80:80 -v /mycharts:/usr/share/nginx/html/mycharts nginx
21ce7fb4724fd60cccac1bb44b99e5a019de1f32e13b36137630b4331bc1ff69
打包解压后的mysql为chart:
[root@vms201 helm]# helm package mysql
Successfully packaged chart and saved it to: /root/helm/mysql-6.8.0.tgz
具体修改打包后的名称,可以在mysql目录下的Chart.yaml文件进行修改version:
[root@vms201 mysql]# cat Chart.yaml
apiVersion: v1
appVersion: 8.0.19
description: Chart to create a Highly available MySQL cluster
engine: gotpl
home: https://mysql.com
icon: https://bitnami.com/assets/stacks/mysql/img/mysql-stack-220x234.png
keywords:
- mysql
- database
- sql
- cluster
- high availablity
maintainers:
- email: containers@bitnami.com
name: Bitnami
name: mysql
sources:
- https://github.com/bitnami/bitnami-docker-mysql
version: 6.8.0
返回到打包charts的目录,创建一个索引文件,记录了这个chart存放在仓库的哪里。其中mycharts这个目录和仓库创建时的卷的位置相同:
[root@vms201 helm]# helm repo index . --url http://192.168.0.203/mycharts
[root@vms201 helm]# ls
get helm-v3.2.1-linux-amd64.tar.gz helm-v3.2.1-linux-amd64.tar.gz.sha256 index.yaml mysql mysql-6.8.0.tgz mysql-6.8.0.tgz.bak
[root@vms201 helm]# cat index.yaml
apiVersion: v1
entries:
mysql:
- apiVersion: v1
appVersion: 8.0.19
created: "2021-07-11T13:38:00.789056037+08:00"
description: Chart to create a Highly available MySQL cluster
digest: 37929dde2c5e486b4f415fcbfab7bc8e960bb108da25a7414259ea8aea705fe8
home: https://mysql.com
icon: https://bitnami.com/assets/stacks/mysql/img/mysql-stack-220x234.png
keywords:
- mysql
- database
- sql
- cluster
- high availablity
maintainers:
- email: containers@bitnami.com
name: Bitnami
name: mysql
sources:
- https://github.com/bitnami/bitnami-docker-mysql
urls:
- http://192.168.0.203/mycharts/mysql-6.8.0.tgz
version: 6.8.0
generated: "2021-07-11T13:38:00.78462512+08:00"
通过这种方式,创建了一个index.yaml的索引信息。将打包好的charts和index.yaml文件拷贝到此仓库中:
scp mysql-6.8.0.tgz index.yaml 192.168.0.203:/mycharts
进入搭建的仓库的被挂载目录,查看文件信息是否已经获取了:
[root@vms203 ~]# docker exec -it web1 ls /usr/share/nginx/html/mycharts
index.yaml mysql-6.8.0.tgz
返回到master上,添加helm源:
[root@vms201 helm]# helm repo add myrepo http://192.168.0.203/mycharts
"myrepo" has been added to your repositories
[root@vms201 helm]# helm repo list
NAME URL
ali https://apphub.aliyuncs.com
myrepo http://192.168.0.203/mycharts
查看仓库里面的charts信息:
[root@vms201 helm]# helm search repo mysql
NAME CHART VERSION APP VERSION DESCRIPTION
ali/mysql 6.8.0 8.0.19 Chart to create a Highly available MySQL cluster
ali/mysqldump 2.6.0 2.4.1 A Helm chart to help backup MySQL databases usi...
ali/mysqlha 1.0.0 5.7.13 MySQL cluster with a single master and zero or ...
ali/prometheus-mysql-exporter 0.5.2 v0.11.0 A Helm chart for prometheus mysql exporter with...
myrepo/mysql 6.8.0 8.0.19 Chart to create a Highly available MySQL cluster
ali/percona 1.2.0 5.7.17 free, fully compatible, enhanced, open source d...
ali/percona-xtradb-cluster 1.0.3 5.7.19 free, fully compatible, enhanced, open source d...
ali/phpmyadmin 4.2.12 5.0.1 phpMyAdmin is an mysql administration frontend
ali/mariadb 7.3.9 10.3.22 Fast, reliable, scalable, and easy to use open-...
ali/mariadb-galera 0.8.1 10.4.12 MariaDB Galera is a multi-master database clust...
可以看到我们搭建的私有源中的mysql信息。然后直接从直接的仓库中拉取charts并部署:
[root@vms201 helm]# helm install mysql myrepo/mysql
NAME: mysql
LAST DEPLOYED: Sun Jul 11 13:50:58 2021
NAMESPACE: helm
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Please be patient while the chart is being deployed
五、helm应用1–prometheus部署
prometheus框架:
其中exporter的作用是收集数据、提供metrics数据接口;被监控的项目叫做target;Grafana可以做图形化呈现、Alertmanager做高级输出。
由于prometheus直接监控K8s比较复杂,所以可以使用prometheus operator框架(基于prometheus开发),来专门监控K8s的环境。
在master上通过helm拉取相关的charts并部署:
[root@vms201 helm]# helm search repo prometheus-operator
NAME CHART VERSION APP VERSION DESCRIPTION
ali/prometheus-operator 8.7.0 0.35.0 Provides easy monitoring definitions for Kubern...
[root@vms201 ~]# helm install monitor ali/prometheus-operator
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
NAME: monitor
LAST DEPLOYED: Sun Jul 11 14:57:40 2021
NAMESPACE: helm
STATUS: deployed
REVISION: 1
NOTES:
The Prometheus Operator has been installed. Check its status by running:
kubectl --namespace helm get pods -l "release=monitor"
Visit https://github.com/coreos/prometheus-operator for instructions on how
to create & configure Alertmanager and Prometheus instances using the Operator.
查看是部署是否成功:
[root@vms201 helm]# helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
monitor helm 1 2021-07-11 14:57:40.997198206 +0800 CST deployed prometheus-operator-8.7.0 0.35.0
[root@vms201 helm]# kubectl get pods
NAME READY STATUS RESTARTS AGE
alertmanager-monitor-prometheus-operato-alertmanager-0 2/2 Running 0 2m38s
monitor-grafana-75fc756dbb-bxgrr 2/2 Running 0 3m47s
monitor-kube-state-metrics-7454cd7cf7-g82w2 1/1 Running 0 3m47s
monitor-prometheus-node-exporter-52hpf 1/1 Running 0 3m47s
monitor-prometheus-node-exporter-97w8v 1/1 Running 0 3m47s
monitor-prometheus-node-exporter-j4zt5 1/1 Running 0 3m47s
monitor-prometheus-operato-operator-5fcbf7c8d5-nxdbp 2/2 Running 0 3m47s
prometheus-monitor-prometheus-operato-prometheus-0 3/3 Running 1 2m28s
[root@vms201 helm]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 2m56s
monitor-grafana ClusterIP 10.99.251.18 <none> 80/TCP 4m5s
monitor-kube-state-metrics ClusterIP 10.104.87.66 <none> 8080/TCP 4m5s
monitor-prometheus-node-exporter ClusterIP 10.96.109.146 <none> 9100/TCP 4m5s
monitor-prometheus-operato-alertmanager ClusterIP 10.111.131.169 <none> 9093/TCP 4m5s
monitor-prometheus-operato-operator ClusterIP 10.99.184.203 <none> 8080/TCP,443/TCP 4m5s
monitor-prometheus-operato-prometheus ClusterIP 10.96.136.135 <none> 9090/TCP 4m5s
prometheus-operated ClusterIP None <none> 9090/TCP 2m45s
修改alertmanager-operated的type为NodePort:
[root@vms201 helm]# kubectl edit svc monitor-grafana
service/monitor-grafana edited
然后直接在物理机上通过集群任意一个node的31049端口访问grafana:
[root@vms201 helm]# kubectl get svc monitor-grafana
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
monitor-grafana NodePort 10.99.251.18 <none> 80:31049/TCP 9m3s
登陆界面:
登陆的账号和密码是通过secret保存的,我们需要先去查看:
[root@vms201 helm]# kubectl get secrets monitor-grafana -o jsonpath='{.data.admin-user}' | base64 -d
admin
[root@vms201 helm]# kubectl get secrets monitor-grafana -o jsonpath='{.data.admin-password}' | base64 -d
prom-operator
可以看到账号和密码为admin和prom-operator。登陆后,可以看到默认已经连接到了prometheus数据源上。
按照如下的图示点击,查看监控的信息:
可以看到监控的内容:
例如点击对于pod的监控,选择了正确的namespace后,可以看到如下信息:
如果不满意目前的dashboard,可以在官网上去下载:https://grafana.com/grafana/dashboards
导入所需要的dashboard:
可以看到编号为:13105
点击import:并输入13105
这时候dashboard会被自动识别:
import以后,就可以看到导入的dashboard呈现了:
完成测试后删除掉当前部署的prometheus的charts:
[root@vms201 helm]# helm del monitor
release "monitor" uninstalled
六、helm应用1–EFK部署
ELK简介:
- Elasticsearch:是个开源分布式搜索引擎,存储日志及提供查询接口;
- Logstash:是一个完全开源的工具,他可以对日志进行收集 发送给Elasticsearch;
- Kibana:是一个开源和免费的,web界面的工具,可以让用户浏览Elasticsearch里的日志;
logstash性能低,消耗资源,且存在不支持消息队列缓存及存在数据丢失的问题。所以logstash一般可以用fluentd或者filebeat替代,这种架构也被称为EFK架构。
架构图:
Filebeat或者Logstash在node上收集并整理日志信息,然后将信息打给elasticsearch这个搜索型数据库,然后用kibana做web呈现。
注意:本次实验对设备的要求比较高,每个node最好8G+4核以上(由于电脑性能不够,这个使用仅用了一个master+worker)。
前期准备:
在部署EFK之前,需要添加官方的helm源:
[root@vms201 efk]# helm repo add elastic https://helm.elastic.co
"elastic" has been added to your repositories
[root@vms201 efk]# helm repo list
NAME URL
ali https://apphub.aliyuncs.com
myrepo http://192.168.0.203/mycharts
elastic https://helm.elastic.co
在node中下载EFK使用的相关Charts,其中metricbeat是做监控度量。
helm pull elastic/elasticsearch
helm pull elastic/filebeat
helm pull elastic/kibana
helm pull elastic/metricbeat
下载完成后可以得到.tgz的压缩文件。由于镜像(包含好几个G的镜像)比较大,本次实验我采用将已经提前下载好的EKF文件进行导入的方式来完成。
现在所有设备上都有了对应的镜像文件,然后再所有设备上加载镜像:
docker load -i elastic7.9.1.tar
docker load -i filebeat7.9.1.tar
docker load -i kibana7.9.1.tar
docker load -i metricbeat7.9.1.tar
在Master上解压下载下来的.tgz文件:
tar zxvf elasticsearch-7.9.1.tgz
tar zxvf filebeat-7.9.1.tgz
tar zxvf kibana-7.9.1.tgz
tar zxvf metricbeat-7.9.1.tgz
每解压一个文件,就会生成一个对应的目录:
[root@vms201 efk]# ls
elasticsearch filebeat kibana metricbeat
elasticsearch-7.9.1.tgz filebeat-7.9.1.tgz kibana-7.9.1.tgz metricbeat-7.9.1.tgz
1.安装elasticsearch
进入elasticsearch目录中,修改values.yaml的文件
[root@vms201 elasticsearch]# ls
Chart.yaml examples Makefile README.md templates values.yaml
values.yaml文件中可以修改的地方:
副本数和master数量,按照自己的集群来修改即可。
replicas: 1
minimumMasterNodes: 1
持久性存储:设置为不启用
podSecurityPolicy:
create: false
name: ""
spec:
privileged: true
fsGroup:
rule: RunAsAny
runAsUser:
rule: RunAsAny
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
volumes:
- secret
- configMap
# - persistentVolumeClaim
persistence:
enabled: false
labels:
# Add default labels for the volumeClaimTemplate fo the StatefulSet
enabled: false
annotations: {}
安装elasticsearch并查看:
[root@vms201 elasticsearch]# helm install elasticsearch .
NAME: elasticsearch
LAST DEPLOYED: Sun Jul 11 16:50:06 2021
NAMESPACE: helm
STATUS: deployed
REVISION: 1
NOTES:
1. Watch all cluster members come up.
$ kubectl get pods --namespace=helm -l app=elasticsearch-master -w
2. Test cluster health using Helm test.
$ helm test elasticsearch --cleanup
[root@vms201 elasticsearch]# kubectl get pods
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 1/1 Running 0 55s
2.安装filebeat
进入入filebeat目录中,直接安装:
[root@vms201 filebeat]# helm install firebeat .
NAME: firebeat
LAST DEPLOYED: Sun Jul 11 16:54:11 2021
NAMESPACE: helm
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Watch all containers come up.
$ kubectl get pods --namespace=helm -l app=firebeat-filebeat -w
查看pod信息:
[root@vms201 filebeat]# kubectl get pods
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 1/1 Running 0 4m38s
firebeat-filebeat-vkl5d 1/1 Running 0 33s
3.安装metricsbeat
进入metricsbeat的目录下,直接安装:
[root@vms201 metricbeat]# helm install metricbeat .
NAME: metricbeat
LAST DEPLOYED: Sun Jul 11 16:56:31 2021
NAMESPACE: helm
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Watch all containers come up.
$ kubectl get pods --namespace=helm -l app=metricbeat-metricbeat -w
查看pod信息:
[root@vms201 metricbeat]# kubectl get pods
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 1/1 Running 0 6m45s
firebeat-filebeat-vkl5d 1/1 Running 0 2m40s
metricbeat-kube-state-metrics-75c5fc65d9-nszcx 1/1 Running 0 20s
metricbeat-metricbeat-d4pg2 1/1 Running 0 20s
metricbeat-metricbeat-metrics-7c5cd7d77f-n5nbw 1/1 Running 0 20s
4.安装kibana
进入kibana的目录下,修改value.yaml文件,修改的地方如下:将service的type修改为NodePort,方便用户在外部访问。
service:
type: NodePort
loadBalancerIP: ""
port: 5601
nodePort: ""
labels: {}
annotations: {}
# cloud.google.com/load-balancer-type: "Internal"
# service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
# service.beta.kubernetes.io/azure-load-balancer-internal: "true"
# service.beta.kubernetes.io/openstack-internal-load-balancer: "true"
# service.beta.kubernetes.io/cce-load-balancer-internal-vpc: "true"
loadBalancerSourceRanges: []
# 0.0.0.0/0
安装kibana,并查看pod信息:
[root@vms201 kibana]# helm install kibana .
NAME: kibana
LAST DEPLOYED: Sun Jul 11 17:01:41 2021
NAMESPACE: helm
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@vms201 kibana]# kubectl get pods
NAME READY STATUS RESTARTS AGE
elasticsearch-master-0 1/1 Running 0 13m
firebeat-filebeat-vkl5d 1/1 Running 0 9m24s
kibana-kibana-f88767f86-g9s8h 1/1 Running 0 114s
metricbeat-kube-state-metrics-75c5fc65d9-nszcx 1/1 Running 0 7m4s
metricbeat-metricbeat-d4pg2 1/1 Running 0 7m4s
metricbeat-metricbeat-metrics-7c5cd7d77f-n5nbw 1/1 Running 0 7m4s
5.查看SVC,并使用外部设备访问kibana:
[root@vms201 kibana]# kubectl get svc kibana-kibana
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kibana-kibana NodePort 10.105.51.141 <none> 5601:32281/TCP 2m56s
可以看到端口是32281。在外部使用游览器访问集群中任何一个设备的32281端口即可;选择使用自己的数据后,可以看到如下页面:
对手机的信息进行分片:
匹配到相应的数据:
创建相应的索引模式:
重新访问kibana的discovery页面,可以看到分片的结果:
然后再kibana的Dashboard处可以创建相应的Bashboard,将信息做图形化呈现,这里就略过了,可以参考这篇文章:
https://blog.csdn.net/tushanpeipei/article/details/117373204?spm=1001.2014.3001.5501
参考资料:
《老段CKA课程》
更多推荐
所有评论(0)