文章目录
- 前言
- 一、ECK是什么?
- 二、安装ECK
- 1.crd.yaml
- 2.operator.yaml
- 三、安装es,elasticsearch-cluster.yaml
- 四、安装kibana
- 总结
前言
在k8s上基于ECK(2.4)部署elasticsearch,简单记录一下,主要是quickstart的快速模式下增加了nodeport端口和可以定义密码的超级管理员账号。不说废话,直接上干货。
参考链接
ECK官网链接: https://www.elastic.co/cn/elastic-cloud-kubernetes
ECK快速启动链接: https://www.elastic.co/guide/en/cloud-on-k8s/2.4/k8s-deploy-eck.html
ECK增加es集群用户链接: https://www.elastic.co/guide/en/cloud-on-k8s/2.4/k8s-users-and-roles.html
一、ECK是什么?
Elastic Cloud on Kubernetes 简化了在 Kubernetes 中运行 Elasticsearch 和 Kibana 的作业,包括设置、升级、快照、扩展、高可用性、安全性等。
二、安装ECK
1.crd.yaml
kubectl create -f https://download.elastic.co/downloads/eck/2.4.0/crds.yaml
文件中的内容比较多,我就不把内容贴进来了。无法在线使用的,可以先下载下来然后传到对应机器上
2.operator.yaml
kubectl apply -f https://download.elastic.co/downloads/eck/2.4.0/operator.yaml
三、安装es,elasticsearch-cluster.yaml
#执行
kubectl apply -f elasticsearch-cluster.yaml
#输出
namespace/daxinxindahaohao created
elasticsearch.elasticsearch.k8s.elastic.co/quickstart created
service/quickstart-es-internal-http-nodeport created
secret/daxinxindahaohao-secret created
#创建namespace
apiVersion: v1
kind: Namespace
metadata:
name: daxinxindahaohao
---
#快速启动es集群
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
namespace: daxinxindahaohao
spec:
version: 8.7.1
#增加账号信息
auth:
fileRealm:
- secretName: daxinxindahaohao-secret
nodeSets:
- name: default
count: 1
config:
node.store.allow_mmap: false
---
#增加专属的service,不修改quickstart已有的service
kind: Service
apiVersion: v1
metadata:
name: quickstart-es-internal-http-nodeport
namespace: daxinxindahaohao
labels:
common.k8s.elastic.co/type: elasticsearch
elasticsearch.k8s.elastic.co/cluster-name: quickstart
spec:
ports:
- name: https
protocol: TCP
port: 9200
targetPort: 9200
nodePort: 30806
selector:
common.k8s.elastic.co/type: elasticsearch
elasticsearch.k8s.elastic.co/cluster-name: quickstart
type: NodePort
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
---
# 新增用户daxinxindahaohao,设置组为超级管理员
kind: Secret
apiVersion: v1
metadata:
name: daxinxindahaohao-secret
namespace: daxinxindahaohao
stringData:
#格式是 账号:密码
#可以同时增加多个用户并设置对应的组
users: |-
daxinxindahaohao:daxinxindahaohao
users_roles: |-
superuser:daxinxindahaohao
结果截图-容器组
结果截图-服务
结果截图-密钥
结果截图:登陆验证
结果截图:成功登陆
四、安装kibana
#执行
kubectl apply -f kibana.yaml
#输出
kibana.kibana.k8s.elastic.co/quickstart created
service/quickstart-kb-http-nodeport created
# 快速启动kibana,命名空间为daxinxindahaohao
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
name: quickstart
namespace: daxinxindahaohao
spec:
version: 8.7.1
count: 1
elasticsearchRef:
name: quickstart
namespace: daxinxindahaohao
---
# 增加oneops项目专属的service,不修改quickstart已有的service
kind: Service
apiVersion: v1
metadata:
name: quickstart-kb-http-nodeport
namespace: daxinxindahaohao
labels:
common.k8s.elastic.co/type: kibana
kibana.k8s.elastic.co/name: quickstart
spec:
ports:
- name: https
protocol: TCP
port: 5601
targetPort: 5601
nodePort: 30807
selector:
common.k8s.elastic.co/type: kibana
kibana.k8s.elastic.co/name: quickstart
type: NodePort
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
执行结果-工作负载
执行结果-容器组
执行结果-服务
执行结果-登陆页面
总结
还是挺好用的,比较快捷,但是高阶功能可能要根据场景情况摸索一下。