From b5e0a1e176f3c6c6d37f88b5ec16122064590137 Mon Sep 17 00:00:00 2001 From: ycz008 Date: Fri, 3 Nov 2023 16:05:54 +0800 Subject: [PATCH] tcs update --- tcs-upgrade/elastic/elastic.yaml | 110 ++++++++++++++++++++++++++----- tcs-upgrade/elastic/kibana.yaml | 68 ------------------- tcs-upgrade/elastic/stroage.yaml | 68 +------------------ 3 files changed, 96 insertions(+), 150 deletions(-) delete mode 100644 tcs-upgrade/elastic/kibana.yaml diff --git a/tcs-upgrade/elastic/elastic.yaml b/tcs-upgrade/elastic/elastic.yaml index bd9592c..7ff3c03 100644 --- a/tcs-upgrade/elastic/elastic.yaml +++ b/tcs-upgrade/elastic/elastic.yaml @@ -1,3 +1,81 @@ +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: elastic-tcs-0 +spec: + storageClassName: elastic-tcs + capacity: + storage: 30Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic-tcs/es_data + claimRef: + kind: PersistentVolumeClaim + namespace: tcs + name: elastic-tcs-elastic-0 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-5.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: elastic-tcs-1 +spec: + storageClassName: elastic-tcs + capacity: + storage: 30Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic-tcs/es_data + claimRef: + kind: PersistentVolumeClaim + namespace: + name: elastic-tcs-elastic-1 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: elastic-tcs-2 +spec: + storageClassName: elastic-tcs + capacity: + storage: 30Gi + accessModes: + - ReadWriteOnce + local: + path: /data/elastic-tcs/es_data + claimRef: + kind: PersistentVolumeClaim + namespace: tcs + name: elastic-tcs-elastic-2 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - bfs-k8snode-10-2-1-7.hetzner.base.beaconfireinc.com + --- apiVersion: apps/v1 kind: StatefulSet @@ -17,18 +95,21 @@ spec: securityContext: fsGroup: 100 nodeSelector: - kubernetes.io/arch: amd64 + app.kubernetes.io/name: es-tcs initContainers: - name: init image: busybox imagePullPolicy: IfNotPresent - command: ["/bin/sh", "-c", "sysctl -w vm.max_map_count=262144"] + 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-tcs + mountPath: /usr/share/elasticsearch/data containers: - name: elasticsearch - image: docker.elastic.co/elasticsearch/elasticsearch:8.8.0 - imagePullPolicy: Always + image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 + imagePullPolicy: IfNotPresent ports: - containerPort: 9200 name: restful @@ -36,7 +117,7 @@ spec: name: transport env: - name: cluster.name - value: bfs-elastic-1 + value: bfs-elastic-tcs-1 - name: network.host value: 0.0.0.0 - name: node.name @@ -48,11 +129,9 @@ spec: - name: cluster.initial_master_nodes value: "elastic-0,elastic-1,elastic-2" - name: xpack.security.enabled - value: "true" - - name: xpack.security.transport.ssl.enabled - value: "true" + value: "false" - name: xpack.monitoring.collection.enabled - value: "true" + value: "false" - name: ES_JAVA_OPTS value: "-Xms256m -Xmx256m" - name: ELASTIC_PASSWORD @@ -65,14 +144,14 @@ spec: cpu: 100m memory: 128Mi volumeMounts: - - name: es-data + - name: elastic-tcs mountPath: /usr/share/elasticsearch/data volumeClaimTemplates: - metadata: - name: es-data + name: elastic-tcs spec: accessModes: ['ReadWriteOnce'] - storageClassName: "local-elastic" + storageClassName: "elastic-tcs" resources: requests: storage: 30Gi @@ -89,16 +168,16 @@ spec: - name: restful port: 9200 targetPort: 9200 - nodePort: 30020 + # nodePort: 30029 type: NodePort selector: - app: elastic + app: elastic --- apiVersion: v1 kind: Service metadata: - name: elastic + name: elastic labels: app: elastic spec: @@ -110,3 +189,4 @@ spec: clusterIP: None selector: app: elastic + diff --git a/tcs-upgrade/elastic/kibana.yaml b/tcs-upgrade/elastic/kibana.yaml deleted file mode 100644 index 4a5a9ef..0000000 --- a/tcs-upgrade/elastic/kibana.yaml +++ /dev/null @@ -1,68 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: kibana-config -data: - kibana.yml: |- - server.name: kibana - server.host: 0.0.0.0 - elasticsearch.hosts: [ "http://elastic:9200" ] - monitoring.ui.container.elasticsearch.enabled: true - elasticsearch.username: kibana-admin - elasticsearch.password: admin123 ---- -apiVersion: v1 -kind: Service -metadata: - name: kibana - labels: - app: kibana -spec: - ports: - - port: 5601 - targetPort: 5601 - nodePort: 30019 - selector: - app: kibana - type: NodePort ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kibana - labels: - app: kibana -spec: - replicas: 1 - selector: - matchLabels: - app: kibana - template: - metadata: - labels: - app: kibana - spec: - containers: - - name: kibana - image: docker.elastic.co/kibana/kibana:8.8.0 - volumeMounts: - - name: config - mountPath: /usr/share/kibana/config/kibana.yml - subPath: kibana.yml - readOnly: true - resources: - requests: - cpu: 100m - memory: 128Mi - limits: - cpu: 1 - memory: 1Gi - ports: - - containerPort: 5601 - volumes: - - name: config - configMap: - name: kibana-config - items: - - key: kibana.yml - path: kibana.yml \ No newline at end of file diff --git a/tcs-upgrade/elastic/stroage.yaml b/tcs-upgrade/elastic/stroage.yaml index 1e4a78e..51ab497 100644 --- a/tcs-upgrade/elastic/stroage.yaml +++ b/tcs-upgrade/elastic/stroage.yaml @@ -1,74 +1,8 @@ ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: local-elastic-0 -spec: - storageClassName: local-elastic - capacity: - storage: 50Gi - accessModes: - - ReadWriteOnce - local: - path: /data/elastic/es_data - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - bfs-k8snode-10-2-1-6.hetzner.base.beaconfireinc.com - ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: local-elastic-1 -spec: - storageClassName: local-elastic - capacity: - storage: 50Gi - accessModes: - - ReadWriteOnce - local: - path: /data/elastic/es_data - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - bfs-k8snode-10-2-1-7.hetzner.base.beaconfireinc.com - ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: local-elastic-2 -spec: - storageClassName: local-elastic - capacity: - storage: 50Gi - accessModes: - - ReadWriteOnce - local: - path: /data/elastic/es_data - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - bfs-k8snode-10-2-1-8.hetzner.base.beaconfireinc.com - --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: - name: local-elastic + name: elastic-tcs provisioner: openebs.io/local allowVolumeExpansion: true volumeBindingMode: WaitForFirstConsumer