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
相关推荐
Pastthewind18 分钟前
docker-compose部署ES
elasticsearch
java_logo3 小时前
Docker 部署 Elasticsearch 全流程手册
大数据·运维·mongodb·elasticsearch·docker·容器
熟悉的新风景5 小时前
window安装Elasticsearch(es)
大数据·elasticsearch·jenkins
周杰伦_Jay6 小时前
【Elasticsearch 全解析】分布式搜索引擎的原理、实践与优化
大数据·分布式·elasticsearch·架构·开源·1024程序员节
睡不醒的猪儿8 小时前
k8s部署自动化工具jenkins
云原生·kubernetes·自动化·jenkins
KevinPedri10 小时前
测试:uk8s创建监控和告警同步飞书等渠道
docker·kubernetes·云计算·1024程序员节
秋千码途11 小时前
在K8S中部署MySQL主从
mysql·云原生·容器·kubernetes
回忆是昨天里的海12 小时前
k8s部署容器化应用-tomcat
云原生·容器·kubernetes·1024程序员节
会飞的小蛮猪13 小时前
ELK运维之路(异常日志告警)
elasticsearch·自动化运维·logstash
helloworddm18 小时前
Orleans + Kubernetes + Istio 服务网格集成深度解析
容器·kubernetes·istio