blob: a4e1ea367ee914b37487015597050bd3199a83f0 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# To create Elasticsearch frontend cluster Kubernetes service.
# It sets up a load balancer on TCP port 9200 that distributes network traffic to the ES nodes.
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
labels:
component: elasticsearch
spec:
selector:
component: elasticsearch
type: NodePort
ports:
- name: http
port: 9200
protocol: TCP
- name: transport
port: 9300
protocol: TCP
---
# The Kubernetes deployment script for Elasticsearch replication nodes. It will create 1 node cluster.
# To scale the cluster as desired, you can create replicas of node use 'kubectl scale --replicas=3 rc es' command
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: es
labels:
component: elasticsearch
spec:
replicas: 1
template:
metadata:
labels:
component: elasticsearch
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "sysctl",
"image": "busybox",
"imagePullPolicy": "IfNotPresent",
"command": ["sysctl", "-w", "vm.max_map_count=262144"],
"securityContext": {
"privileged": true
}
}
]'
spec:
containers:
- name: es
securityContext:
capabilities:
add:
# IPC_LOCK capability is enabled to allow Elasticsearch to lock the heap in memory so it will not be swapped.
- IPC_LOCK
# SYS_RESOURCE capability is set to control and override various resource limits.
- SYS_RESOURCE
image: quay.io/pires/docker-elasticsearch-kubernetes:5.2.2
env:
- name: "CLUSTER_NAME"
value: "myesdb"
- name: "DISCOVERY_SERVICE"
value: "elasticsearch"
- name: NODE_MASTER
value: "true"
- name: NODE_DATA
value: "true"
- name: HTTP_ENABLE
value: "true"
ports:
- containerPort: 9200
name: http
protocol: TCP
- containerPort: 9300
name: transport
protocol: TCP
volumeMounts:
- mountPath: /data
name: storage
volumes:
- name: storage
emptyDir: {}