返回介绍

PART Ⅰ : 容器云OPENSHIFT

PART Ⅱ:容器云 KUBERNETES

PART Ⅲ:持续集成与持续部署

PART Ⅴ:日志/监控/告警

PART Ⅵ:基础

PART Ⅶ:数据存储、处理

PART VIII:CODE

PART X:HACKINTOSH

PART XI:安全

Kibana 容器化部署

发布于 2024-06-08 21:16:47 字数 5649 浏览 0 评论 0 收藏 0

DeploymentConfig

apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  labels:
    app: kibana
  name: kibana
spec:
  replicas: 1
  selector:
    app: kibana
    deploymentconfig: kibana
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      labels:
        app: kibana
        deploymentconfig: kibana
    spec:
      containers:
      - env:
        - name: ELASTICSEARCH_USERNAME
          value: kibana
        - name: ELASTICSEARCH_PASSWORD
          value: uLAWAfW1b7UHZdHEigCW
        - name: TZ
          value: Asia/Shanghai
        image: docker.elastic.co/kibana/kibana:7.1.1
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 5601
          timeoutSeconds: 1
        name: kibana
        ports:
        - containerPort: 5601
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 5601
          timeoutSeconds: 1
        resources:
          limits:
            cpu: "1"
            memory: 1500Mi
          requests:
            cpu: 500m
            memory: 800Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
  test: false
  triggers:
  - type: ConfigChange

SVC

apiVersion: v1
kind: Service
metadata:
  labels:
    app: kibana
  name: kibana
spec:
  ports:
  - name: 5601-tcp
    port: 5601
    protocol: TCP
    targetPort: 5601
  selector:
    deploymentconfig: kibana
  sessionAffinity: None
  type: ClusterIP

Route

apiVersion: route.openshift.io/v1
kind: Route
metadata:
  labels:
    app: apache-kibana
  name: kibana
spec:
  port:
    targetPort: 5601-tcp
  to:
    kind: Service
    name: kibana
    weight: 100
  wildcardPolicy: None

Deployment

apiVersion: apps/v1beta2
kind: Deployment
metadata:
  labels:
    app: kibana
  name: kibana
  namespace: elk
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: kibana
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: kibana
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                -  node1.k8s.curiouser.com
      containers:
      - image: kibana/kibana:7.2.0
        imagePullPolicy: IfNotPresent
        name: kibana
        envFrom:
        - secretRef:
            name: kibana-config-env
        env:
          - name: TZ
            value: Asia/Shanghai
          - name: ELASTICSEARCH_HOSTS
            value: '["http://elasticsearch.elk.svc:9200"]'
        ports:
        - containerPort: 5601
          name: web
          protocol: TCP
        resources:
          requests:
            memory: "1Gi"
            cpu: "0.5"
          limits:
            memory: "2Gi"
            cpu: "1"
        readinessProbe:
          failureThreshold: 1
          initialDelaySeconds: 60
          periodSeconds: 60
          successThreshold: 1
          tcpSocket:
            port: 5601
          timeoutSeconds: 1
        livenessProbe:
          failureThreshold: 1
          initialDelaySeconds: 60
          periodSeconds: 60
          successThreshold: 1
          tcpSocket:
            port: 5601
          timeoutSeconds: 1
        securityContext:
          allowPrivilegeEscalation: false
          capabilities: {}
          privileged: false
          procMount: Default
          readOnlyRootFilesystem: false
          runAsNonRoot: false
        stdin: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        tty: true
      dnsConfig: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30

Secret

apiVersion: v1
kind: Secret
metadata:
  labels:
    app: kibana
  name: kibana-config-env
  namespace: elk
stringData:
  ELASTICSEARCH_USERNAME: kibana
  ELASTICSEARCH_PASSWORD: kibana

Service

apiVersion: v1
kind: Service
metadata:
  name: kibana
  namespace: elk
  labels:
    app: kibana
spec:
  ports:
  - port: 5601
    name: web
  selector:
    app: kibana

Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kibana
  namespace: elk
spec:
  rules:
  - host: kibana.apps.k8s.curiouser.com
    http:
      paths:
      - path: /
        backend:
          serviceName: kibana
          servicePort: 5601

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文