k8s离线安装单节点elasticsearch7.x

概述

   k8s离线安装单节点elasticsearch7.x

资源

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

实践

脚本

# 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

相关推荐

  1. k8s线安装节点elasticsearch7.x

    2024-07-10 22:14:01       7 阅读
  2. Centos7.9部署节点K8S环境

    2024-07-10 22:14:01       12 阅读
  3. CentOS7.x线安装MySQL8

    2024-07-10 22:14:01       20 阅读

最近更新

  1. android audio 相机按键音:(一)资源加载与替换

    2024-07-10 22:14:01       0 阅读
  2. 使用 Jenkins 实现持续集成和持续部署(CI/CD)

    2024-07-10 22:14:01       0 阅读
  3. TiDB热点问题

    2024-07-10 22:14:01       0 阅读
  4. setup中如何获取组件实例

    2024-07-10 22:14:01       0 阅读

热门阅读

  1. d3tree树控件,点击动态加载,默认展开三层

    2024-07-10 22:14:01       5 阅读
  2. ontape备份异机还原的样例

    2024-07-10 22:14:01       6 阅读
  3. [PaddlePaddle飞桨] PaddleSpeech语言小模型部署

    2024-07-10 22:14:01       6 阅读
  4. vivado DQS_BIAS

    2024-07-10 22:14:01       6 阅读
  5. PHP框架详解-symfony框架

    2024-07-10 22:14:01       7 阅读
  6. 深入理解UTF-8 Encoding在C#中的应用与异常处理

    2024-07-10 22:14:01       7 阅读
  7. Linux 常用命令 - mkdir【创建新目录】

    2024-07-10 22:14:01       7 阅读
  8. stm32实现IIC读写

    2024-07-10 22:14:01       5 阅读
  9. 中小企业和数智化的距离,只差一块华为IdeaHub

    2024-07-10 22:14:01       8 阅读