Myluzh Blog

K8S部署Kibana

发布时间: 2024-9-14 文章作者: myluzh 分类名称: Kubernetes 朗读文章


0x01 部署Kibana
1、编写yaml文件
apiVersion: v1
kind: Service
metadata:
  name: kibana
  namespace: elastic-worker
  labels:
    k8s-app: kibana
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    kubernetes.io/name: "Kibana"
    srv: srv-kibana
spec:
  type: NodePort
  ports:
    - port: 5601
      nodePort: 30000
      protocol: TCP
      targetPort: ui
  selector:
    k8s-app: kibana
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kibana
  namespace: elastic-worker
  labels:
    k8s-app: kibana
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    srv: srv-kibana
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: kibana
  template:
    metadata:
      labels:
        k8s-app: kibana
    spec:
      containers:
        - name: kibana
          image: kibana:7.13.3
          volumeMounts:
            - name: kibana-config
              mountPath: /usr/share/kibana/config/kibana.yml
              readOnly: true
              subPath: kibana.yml
          ports:
            - containerPort: 5601
              name: ui
              protocol: TCP
      volumes:
        - name: kibana-config
          configMap:
            name: kibana
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: kibana
  namespace: elastic-worker
  labels:
    k8s-app: kibana
data:
  kibana.yml: |-
    server.name: kibana
    server.host: "0.0.0.0"
    elasticsearch.hosts: [ "http://es7-headless:9200" ]
    elasticsearch.username: "elastic"
    elasticsearch.password: "jaskdljdaksljd"
    monitoring.ui.container.elasticsearch.enabled: true
    i18n.locale: "zh-CN"
    kibana.index: ".kibana"

标签: k8s kibana k8s部署 apply

发表评论