k8s离线安装单节点elasticsearch7.x

目录

概述

k8s离线安装单节点elasticsearch7.x

资源

镜像可以自己准备,懒人速递 elasticsearch离线安装镜像-版本7.17.22

实践

脚本

yaml 复制代码
# pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: es-nfs
  namespace: default
  labels:
    pvc: es-nfs
spec:
  resources:
    requests:
      storage: 5120Mi
  accessModes:
    - ReadWriteMany
  storageClassName: managed-nfs-storage
---


apiVersion: v1
kind: ConfigMap
metadata:
  namespace: default
  name: es
data:
  elasticsearch.yml: |
    cluster.name: my-cluster
    node.name: node-1
    node.max_local_storage_nodes: 3
    network.host: 0.0.0.0
    http.port: 9200
    discovery.seed_hosts: ["127.0.0.1", "[::1]"]
    cluster.initial_master_nodes: ["node-1"]
    http.cors.enabled: true
    http.cors.allow-origin: /.*/
---

apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: elasticsearch
spec:
  selector:
    matchLabels:
      name: elasticsearch
  replicas: 1
  template:
    metadata:
      labels:
        name: elasticsearch
    spec:
      initContainers:
      - name: init-sysctl
        image: harbor.easzlab.io.local:8443/library/busybox:stable-musl
        command:
        - sysctl
        - -w
        - vm.max_map_count=262144
        securityContext:
          privileged: true
      containers:
      - name: elasticsearch
        image: harbor.easzlab.io.local:8443/library/elasticsearch:7.17.22
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            cpu: 1000m
            memory: 2Gi
          requests:
            cpu: 100m
            memory: 1Gi
        env:
        - name: ES_JAVA_OPTS
          value: -Xms512m -Xmx512m
        ports:
        - containerPort: 9200
        - containerPort: 9300
        volumeMounts:
        - name: elasticsearch-data
          mountPath: /usr/share/elasticsearch/data/
        - name: es-config
          mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
          subPath: elasticsearch.yml
      volumes:
      - name: elasticsearch-data
        persistentVolumeClaim:
          claimName: es-nfs
        # hostPath:
          # path: /data/es
      - name: es-config
        configMap:
          name: es

---

apiVersion: v1
kind: Service
metadata:
  namespace: default
  name: elasticsearch
  labels:
    name: elasticsearch
spec:
  #type: NodePort
  ports:
  - name:  web-9200
    port: 9200
    targetPort: 9200
    protocol: TCP
    #nodePort: 30105
  - name:  web-9300
    port: 9300
    targetPort: 9300
    protocol: TCP
    #nodePort: 30106
  selector:
    name: elasticsearch
相关推荐
Elastic 中国社区官方博客1 小时前
Elastic 的 AI agent skills
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索
阿里云大数据AI技术1 小时前
破解 AI 搜索“效果与成本”双重困境:阿里云 Elasticsearch 向量混合检索最佳实践揭秘
人工智能·elasticsearch
云游牧者2 小时前
K8S故障排查三板斧-CSDN博客
运维·docker·云原生·kubernetes·k8s·容器化·故障排查
Elastic 中国社区官方博客3 小时前
Elasticsearch 9.4 为 Elastic AI 生态系统的下一阶段提供支持:Dell AI Data Platform(与 NVIDIA 合作)
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
大G的笔记本4 小时前
ES中分片的含义
大数据·elasticsearch·搜索引擎
AIDF20264 小时前
K8s 完整知识体系(含架构图)
云原生·容器·kubernetes
@王先生15 小时前
docker安装固定版本20.10 k8s 1.23.17兼容版本
docker·容器·kubernetes
老码观察5 小时前
数环通iPaaS日志存储选型实践:从Elasticsearch到Doris
大数据·elasticsearch·搜索引擎
眷蓝天5 小时前
Kubernetes RBAC 认证机制
云原生·容器·kubernetes
wxh_无香花自开5 小时前
git操作笔记
大数据·elasticsearch·搜索引擎