Skip to content

Commit

Permalink
Beam 13058 k8s apis upgrade - elasticsearch (#18)
Browse files Browse the repository at this point in the history
* Upgrade: removing deprecated initContainer tags and adding selector to deployments in elasticsearch k8s files.

Co-authored-by: Elias Segundo <elias.segundo@luisrazo.local>
  • Loading branch information
elink21 and Elias Segundo authored Mar 18, 2022
1 parent cf2437b commit 5b9eb64
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# 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.
Expand Down Expand Up @@ -33,33 +34,32 @@ spec:
protocol: TCP
---
# The Kubernetes deployment script for Elasticsearch master nodes.
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: es-master
labels:
component: elasticsearch
role: master
role: master
spec:
selector:
matchLabels:
component: elasticsearch
role: master
replicas: 3
template:
metadata:
labels:
component: elasticsearch
role: master
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:
initContainers:
- name: sysctl
image: "busybox"
imagePullPolicy: IfNotPresent
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
containers:
- name: es-master
securityContext:
Expand Down Expand Up @@ -108,38 +108,33 @@ spec:
name: "storage"
---
# Kubernetes deployment script for Elasticsearch client nodes (aka load balancing proxies).
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: es-client
labels:
component: elasticsearch
role: client
spec:
selector:
matchLabels:
component: elasticsearch
role: client
# The no. of replicas can be incremented based on the client usage using HTTP API.
replicas: 1
template:
metadata:
labels:
component: elasticsearch
role: client
annotations:
# Elasticsearch uses a hybrid mmapfs / niofs directory by default to store its indices.
# The default operating system limits on mmap counts is likely to be too low, which may result
# in out of memory exceptions. Therefore, the need to increase virtual memory
# vm.max_map_count for large amount of data in the pod initialization annotation.
pod.beta.kubernetes.io/init-containers: '[
{
"name": "sysctl",
"image": "busybox",
"imagePullPolicy": "IfNotPresent",
"command": ["sysctl", "-w", "vm.max_map_count=262144"],
"securityContext": {
"privileged": true
}
}
]'
spec:
initContainers:
- name: "sysctl"
image: busybox
imagePullPolicy: IfNotPresent
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
containers:
- name: es-client
securityContext:
Expand Down Expand Up @@ -187,33 +182,32 @@ spec:
name: "storage"
---
# Kubernetes deployment script for Elasticsearch data nodes which store and index data.
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: es-data
labels:
component: elasticsearch
role: data
spec:
selector:
matchLabels:
component: elasticsearch
role: data
replicas: 2
template:
metadata:
labels:
component: elasticsearch
role: data
annotations:
pod.beta.kubernetes.io/init-containers: '[
{
"name": "sysctl",
"image": "busybox",
"imagePullPolicy": "IfNotPresent",
"command": ["sysctl", "-w", "vm.max_map_count=1048575"],
"securityContext": {
"privileged": true
}
}
]'
spec:
initContainers:
- name: "sysctl"
image: busybox
imagePullPolicy: IfNotPresent
command: ["sysctl", "-w", "vm.max_map_count=1048575"]
securityContext:
privileged: true
containers:
- name: es-data
securityContext:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,29 @@ spec:
---
# 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
apiVersion: apps/v1
kind: Deployment
metadata:
name: es
labels:
component: elasticsearch
spec:
selector:
matchLabels:
component: elasticsearch
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
}
}
]'
component: elasticsearch
spec:
initContainers:
- name: "sysctl"
image: busybox
imagePullPolicy: IfNotPresent
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
containers:
- name: es
securityContext:
Expand Down Expand Up @@ -94,3 +92,7 @@ spec:
volumes:
- name: storage
emptyDir: {}


- name: storage
emptyDir: {}

0 comments on commit 5b9eb64

Please sign in to comment.