diff --git a/prod-upgrade/elastic/elastic.yaml b/prod-upgrade/elastic/elastic.yaml new file mode 100644 index 0000000..5aee856 --- /dev/null +++ b/prod-upgrade/elastic/elastic.yaml @@ -0,0 +1,190 @@ +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: elastic-prod-0 +spec: + storageClassName: local-elastic + capacity: + storage: 50Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic-prod/es_data + claimRef: + kind: PersistentVolumeClaim + namespace: base + name: elastic-prod-elastic-2 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-2-9.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: elastic-prod-1 +spec: + storageClassName: local-elastic + capacity: + storage: 50Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic-prod/es_data + claimRef: + kind: PersistentVolumeClaim + namespace: base + name: elastic-prod-elastic-0 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-2-10.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: elastic-prod-2 +spec: + storageClassName: local-elastic + capacity: + storage: 50Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic-prod/es_data + claimRef: + kind: PersistentVolumeClaim + namespace: base + name: elastic-prod-elastic-1 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-2-11.hetzner.base.beaconfireinc.com + +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: elastic +spec: + serviceName: elastic + replicas: 3 + selector: + matchLabels: + app: elastic + template: + metadata: + labels: + app: elastic + spec: + securityContext: + fsGroup: 100 + nodeSelector: + kubernetes.io/arch: amd64 + initContainers: + - name: init + image: busybox + imagePullPolicy: IfNotPresent + command: ["/bin/sh", "-c", "sysctl -w vm.max_map_count=262144;chown -R 1000:1000 /usr/share/elasticsearch/data"] + securityContext: + privileged: true + volumeMounts: + - name: elastic-prod + mountPath: /usr/share/elasticsearch/data + containers: + - name: elasticsearch + image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 9200 + name: restful + - containerPort: 9300 + name: transport + env: + - name: cluster.name + value: bfs-elastic-prod-1 + - name: network.host + value: 0.0.0.0 + - name: node.name + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: discovery.seed_hosts + value: "elastic-0.elastic,elastic-1.elastic,elastic-2.elastic" + - name: cluster.initial_master_nodes + value: "elastic-0,elastic-1,elastic-2" + - name: xpack.security.enabled + value: "false" + - name: xpack.monitoring.collection.enabled + value: "false" + - name: ES_JAVA_OPTS + value: "-Xms2048m -Xmx2048m" + - name: ELASTIC_PASSWORD + value: "changeme" + resources: + limits: + cpu: 2 + memory: 4Gi + requests: + cpu: 100m + memory: 512Mi + volumeMounts: + - name: elastic-prod + mountPath: /usr/share/elasticsearch/data + volumeClaimTemplates: + - metadata: + name: elastic-prod + spec: + accessModes: ['ReadWriteOnce'] + storageClassName: "local-elastic" + resources: + requests: + storage: 30Gi + +--- +apiVersion: v1 +kind: Service +metadata: + name: elastic-internel + labels: + app: elastic +spec: + ports: + - name: restful + port: 9200 + targetPort: 9200 + type: ClusterIP + selector: + app: elastic + +--- +apiVersion: v1 +kind: Service +metadata: + name: elastic + labels: + app: elastic +spec: + ports: + - name: restful + port: 9200 + - name: transport + port: 9300 + clusterIP: None + selector: + app: elastic diff --git a/prod-upgrade/elastic/storage.yaml b/prod-upgrade/elastic/storage.yaml new file mode 100644 index 0000000..66825a4 --- /dev/null +++ b/prod-upgrade/elastic/storage.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-elastic +provisioner: openebs.io/local +reclaimPolicy: Retain +allowVolumeExpansion: true +volumeBindingMode: WaitForFirstConsumer \ No newline at end of file