iT邦幫忙

1

K8S架設ELK的E

elk
  • 分享至 

  • xImage
  •  

【YC的迷路青春】

寫給已經架server上Azure然後發現好像要蒐集LOG的人

新增兩個yaml檔案
1.工作負載

kind: Deployment
apiVersion: apps/v1
metadata:
  name: elasticsearch-yc
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: elasticsearch-yc
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: elasticsearch-yc
    spec:
      volumes:
        - name: data
          emptyDir: {}
      initContainers:
        - name: increase-vm-max-map
          image: busybox
          command:
            - sysctl
            - '-w'
            - vm.max_map_count=262144
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
          securityContext:
            privileged: true
      containers:
        - name: elk-elasticsearch
          image: 'docker.elastic.co/elasticsearch/elasticsearch:7.12.0'
          ports:
            - containerPort: 9200
              protocol: TCP
            - containerPort: 9300
              protocol: TCP
          env:
            - name: cluster.name
              value: elasticsearch-cluster
            - name: discovery.zen.ping.unicast.hosts
              value: elasticsearch-discovery
            - name: discovery.zen.minimum_master_nodes
              value: '3'
            - name: discovery.zen.ping_timeout
              value: 5s
            - name: node.master
              value: 'true'
            - name: node.data
              value: 'false'
            - name: node.ingest
              value: 'false'
            - name: ES_JAVA_OPTS
              value: '-Xms256m -Xmx256m'
            - name: discovery.type
              value: single-node
            - name: network.host
              value: 0.0.0.0
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%

1.服務與輸入

kind: Service
apiVersion: v1
metadata:
  name: elasticsearch-yc
  namespace: default
spec:
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9200
      nodePort: 31346
  selector:
    app: elasticsearch-yc
  type: LoadBalancer
  sessionAffinity: None
  externalTrafficPolicy: Cluster

這樣再看下生成的外部IP應該就完成了。


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

0
smallwhitetw
iT邦新手 5 級 ‧ 2021-07-01 22:55:04

版主牛逼,一點精美的圖片,一小段簡潔的說明,即可讓人融會貫通。

我要留言

立即登入留言