# https://github.com/kubernetes/examples/blob/master/staging/elasticsearch/es-rc.yaml
# https://cheatsheet.dennyzhang.com/kubernetes-yaml-templates
apiVersion: v1
kind: Pod
metadata:
  name: dummy
  namespace: default
  labels:
    env: test
spec:
  initContainers:
  - name: init-sysctl
    image: busybox
    imagePullPolicy: IfNotPresent
    command: ["sysctl", "-w", "vm.max_map_count=262144"]
    securityContext:
      privileged: true
  containers:
  - name: es
    securityContext:
      capabilities:
        add:
          - IPC_LOCK
    image: quay.io/pires/docker-elasticsearch-kubernetes:5.6.2
    env:
    - name: KUBERNETES_CA_CERTIFICATE_FILE
      value: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    - name: NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace
    - 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: {}
