部署elasticsearch#定义pvcapiVersion: v1kind: PersistentVolumeClaimmetadata: name: elasticsearch-pvc-data namespace: merryspec: accessModes: - ReadWriteonce volumeMode: Filesystem storageClassName: merry-data-managed-nfs-storage resources: requests: storage: 1000Gi---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: elasticsearch-pvc-log namespace: merryspec: accessModes: - ReadWriteonce volumeMode: Filesystem storageClassName: merry-log-managed-nfs-storage resources: requests: storage: 1000Gi#定义cmapiVersion: v1kind: ConfigMapmetadata: name: elasticsearch-cm namespace: merrydata: elasticsearch.yml: |- cluster.name: "docker-cluster" network.host: 0.0.0.0 xpack.security.enabled: true http.cors.allow-headers: Authorization xpack.security.transport.ssl.enabled: true#定义deployapiVersion: apps/v1kind: Deploymentmetadata: labels: run: elasticsearch name: elasticsearch-deploy namespace: merryspec: replicas: 1 selector: matchLabels: run: elasticsearch template: metadata: labels: run: elasticsearch spec: volumes: - name: elasticsearch-data persistentVolumeClaim: claimName: elasticsearch-pvc-data - name: elasticsearch-log persistentVolumeClaim: claimName: elasticsearch-pvc-log - name: elasticsearch-cm configMap: name: elasticsearch-cm containers: - image: elasticsearch:7.4.0-ik imagePullPolicy: IfNotPresent name: elasticsearch env: - name: discovery.type value: "single-node" volumeMounts: - mountPath: "/usr/share/elasticsearch/data" name: elasticsearch-data - mountPath: "/usr/share/elasticsearch/logs" name: elasticsearch-log - mountPath: "/usr/share/elasticsearch/config/elasticsearch.yml" name: elasticsearch-cm subPath: elasticsearch.yml resources: limits: cpu: 2000m memory: 4096Mi requests: cpu: 20m memory: 1024Mi restartPolicy: Always#定义svcapiVersion: v1kind: Servicemetadata: labels: run: elasticsearch name: elasticsearch-svc namespace: merryspec: ports: - port: 9200 protocol: TCP targetPort: 9200 nodePort: 39200 name: p9200 - port: 9300 protocol: TCP targetPort: 9300 name: p9300 selector: run: elasticsearch type: NodePort部署kibana#定义cmapiVersion: v1kind: ConfigMapmetadata: name: kibana-cm namespace: merrydata: kibana.yml: |- server.name: kibana server.host: "0" elasticsearch.hosts: [ "http://elasticsearch-svc:9200" ] elasticsearch.username: "elastic" elasticsearch.password: "admin12345678"#定义deploykind: DeploymentapiVersion: apps/v1metadata: labels: elastic-app: kibana name: kibana namespace: merryspec: replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: elastic-app: kibana template: metadata: labels: elastic-app: kibana spec: restartPolicy: Always volumes: - name: kibana-yml configMap: name: kibana-cm containers: - name: kibana image: kibana:7.4.0 ports: - containerPort: 5601 protocol: TCP volumeMounts: - mountPath: "/usr/share/kibana/config/kibana.yml" name: kibana-yml subPath: kibana.yml tolerations: - key: node-role.kubernetes.io/master effect: NoSchedule#定义svckind: ServiceapiVersion: v1metadata: labels: elastic-app: kibana name: kibana-svc namespace: merryspec: ports: - port: 5601 targetPort: 5601 nodePort: 35601 selector: elastic-app: kibana type: NodePort部署logstash#待续