K8S 部署安装Elastic Cloud 服务

本文档详细介绍了如何在Kubernetes(K8S)上使用Elastic Cloud on K8S(ECK)进行Elasticsearch服务的部署安装。从安装CRDs和Operator,到查看日志、部署ES实例、获取YAML文件、设置集群密码,再到测试访问、查看部署信息、创建Ingress和PVC,全面覆盖了整个流程。
摘要由CSDN通过智能技术生成

Elastic Cloud On K8S ECK

K8S 部署安装Elastic Cloud 服务

image-20221118174010946

文件信息

image-20220815105323623

安装crds

  • 文件参考官方

安装operator

  • 文件参考官方
kubectl apply -f 002.operator.yaml

image-20220808145815952

image-20220808145740213

查看operator日志

kubectl -n elastic-system logs -f statefulset.apps/elastic-operator

image-20220808145716338

image-20220808145643365

image-20220808145508684

使用ECK部署ES

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: lit
  namespace: elastic-system
spec:
  version: 8.3.3
  image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3 #指定镜像
  auth:
    fileRealm:
    - secretName: kubesphere-elasticsearch-realm-secret # 通过Kubernetes secret添加自定义用户和密码
  http:
    tls:
      selfSignedCertificate:
        disabled: true # 关闭tls
  nodeSets:
  - name: lit 
    count: 3 # 部署集群节点数
    config:
      node.store.allow_mmap: false
    volumeClaimTemplates: # 存储配置
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        storageClassName: alicloud-nas

  • 番外示例

[root@Master 002.ElasticCloud]# cat 003.ElasticSearch-Cluster.sh 
cat <<EOF | kubectl apply -f -
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: lit-eck
spec:
  version: 8.3.3
  nodeSets:
  - name: default
    count: 3
    config:
      node.store.allow_mmap: false
EOF




[root@Master 002.ElasticCloud]# cat es1.yaml 
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: lit
  namespace: elastic-system
spec:
  version: 8.3.3
  image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3 #指定镜像
  auth:
    fileRealm:
    - secretName: kubesphere-elasticsearch-realm-secret # 通过Kubernetes secret添加自定义用户和密码
  http:
    tls:
      selfSignedCertificate:
        disabled: true # 关闭tls
  nodeSets:
  - name: lit 
    count: 3 # 部署集群节点数
    config:
      node.store.allow_mmap: false
    volumeClaimTemplates: # 存储配置
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        storageClassName: alicloud-nas

获取yaml文件

#   由已经启动的StatefulSet获取出的yaml文件:
# kubectl get statefulsets.apps -n elastic-system lit-es-lit -o yaml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  creationTimestamp: "2022-08-10T02:34:08Z"
  generation: 1
  labels:
    common.k8s.elastic.co/template-hash: "2038917924"
    common.k8s.elastic.co/type: elasticsearch
    elasticsearch.k8s.elastic.co/cluster-name: lit
    elasticsearch.k8s.elastic.co/statefulset-name: lit-es-lit
  name: lit-es-lit
  namespace: elastic-system
  ownerReferences:
  - apiVersion: elasticsearch.k8s.elastic.co/v1
    blockOwnerDeletion: true
    controller: true
    kind: Elasticsearch
    name: lit
    uid: 47379a1b-ddcb-4552-9909-0e4253441691
  resourceVersion: "41911788"
  uid: e166e637-d67a-4a97-9aed-02dd0754da38
spec:
  podManagementPolicy: Parallel
  replicas: 3
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      common.k8s.elastic.co/type: elasticsearch
      elasticsearch.k8s.elastic.co/cluster-name: lit
      elasticsearch.k8s.elastic.co/statefulset-name: lit-es-lit
  serviceName: lit-es-lit
  template:
    metadata:
      annotations:
        co.elastic.logs/module: elasticsearch
        elasticsearch.k8s.elastic.co/config-hash: "3117001397"
      creationTimestamp: null
      labels:
        common.k8s.elastic.co/type: elasticsearch
        elasticsearch.k8s.elastic.co/cluster-name: lit
        elasticsearch.k8s.elastic.co/http-scheme: http
        elasticsearch.k8s.elastic.co/node-data: "true"
        elasticsearch.k8s.elastic.co/node-data_cold: "true"
        elasticsearch.k8s.elastic.co/node-data_content: "true"
        elasticsearch.k8s.elastic.co/node-data_frozen: "true"
        elasticsearch.k8s.elastic.co/node-data_hot: "true"
        elasticsearch.k8s.elastic.co/node-data_warm: "true"
        elasticsearch.k8s.elastic.co/node-ingest: "true"
        elasticsearch.k8s.elastic.co/node-master: "true"
        elasticsearch.k8s.elastic.co/node-ml: "true"
        elasticsearch.k8s.elastic.co/node-remote_cluster_client: "true"
        elasticsearch.k8s.elastic.co/node-transform: "true"
        elasticsearch.k8s.elastic.co/node-voting_only: "false"
        elasticsearch.k8s.elastic.co/statefulset-name: lit-es-lit
        elasticsearch.k8s.elastic.co/version: 8.3.3
    spec:
      affinity:
        podAntiAffinity:
          
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WinJayX

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值