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
相关推荐
Elasticsearch10 分钟前
从多模态 LLM 中引导构建音频嵌入
elasticsearch
Elasticsearch2 小时前
一笔交易,三个字段名称:使用 ECS 修复大型机数据
elasticsearch
Elasticsearch2 小时前
4 个英伟达人工智能任务,1 个 Elasticsearch 接口:嵌入、聊天、completion 和重排序
elasticsearch
前端Baymax3 小时前
kube-proxy iptables模式下NodePort间歇性超时
docker·容器·kubernetes
欢醉3 小时前
k8s的pod容器中微服务无法创建新线程unable to create new native thread
kubernetes·springboot
IT新视界18 小时前
Elasticsearch信创国产化替代
大数据·elasticsearch·搜索引擎
Elasticsearch20 小时前
用 Elasticsearch 的 RRF 融合检索,把矿物鉴定准确率从 36% 拉到 92%
elasticsearch
Elasticsearch21 小时前
景枢:基于 Elastic AI Agent Builder 的多景区购票智能运维中枢技术解析
elasticsearch
蜀道山老天师1 天前
一文吃透 K8s:Deployment 滚动更新与版本回滚
云原生·容器·kubernetes
kylin-运维1 天前
k8s可视化看板嵌入AI助手(悬浮对话球)
人工智能·容器·kubernetes·aicoding