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
相关推荐
程序员阿伦4 小时前
璋㈤鏈虹殑Java澶у巶闈㈣瘯璁帮細浠嶴pring Boot鍒癒ubernetes锛�3杞湡棰樺叏瑙f瀽锛�
spring boot·redis·kubernetes·aigc·java闈㈣瘯·寰湇鍔�·鐢靛晢绉掓潃
狼与自由5 小时前
K8S的架构
容器·架构·kubernetes
小飞Coding5 小时前
ES 性能调优核心:读懂线程栈,告别“请求被拒绝”与“集群卡顿”
elasticsearch
Elastic 中国社区官方博客6 小时前
现已正式发布: Elastic Cloud Hosted 上的托管 OTLP Endpoint
大数据·运维·数据库·功能测试·elasticsearch·全文检索
小飞Coding6 小时前
一文吃透 Elasticsearch 索引模板+别名:零误导、可复现的生产级实践
elasticsearch
普通网友7 小时前
《K8s 滚动更新与回滚:详细教程》
docker·容器·kubernetes
朱包林7 小时前
k8s-Pod基础管理,标签管理,rc控制器及重启策略实战
linux·运维·云原生·容器·kubernetes·云计算
returnthem7 小时前
最新版 Kubernetes 集群搭建教程(kubeadm 方式)
云原生·容器·kubernetes
白花生7 小时前
k8s集群内的ollama pod持久化调用本地大模型
云原生·容器·kubernetes
秋刀鱼什么味_7 小时前
kubernetes服务质量之QoS类
容器·kubernetes