• K8S 之健康检查


    健康检查

    为了确保容器在部署后确实处在正常运行状态,Kubernetes提供了两种探针(Probe,支持exec、tcp和httpGet方式)来探测容器的状态:

    • LivenessProbe:探测应用是否处于健康状态,如果不健康则删除重建改容器
    • ReadinessProbe:探测应用是否启动完成并且处于正常服务状态,如果不正常则更新容器的状态
    apiVersion: v1
    kind: Pod
    metadata:
      labels:
        app: nginx
      name: nginx
    spec:
        containers:
        - image: nginx
          imagePullPolicy: Always
          name: http
          livenessProbe:
            httpGet:
            path: /
            port: 80
            initialDelaySeconds: 15
            timeoutSeconds: 1
          readinessProbe:
            httpGet:
            path: /ping
            port: 80
            initialDelaySeconds: 5
            timeoutSeconds: 1
    

    Init Container

    Init Container在所有容器运行之前执行(run-to-completion),常用来初始化配置。

    apiVersion: v1
    kind: Pod
    metadata:
      name: init-demo
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:
        - name: workdir
          mountPath: /usr/share/nginx/html
      # These containers are run during pod initialization
      initContainers:
      - name: install
        image: busybox
        command:
        - wget
        - "-O"
        - "/work-dir/index.html"
        - http://kubernetes.io
        volumeMounts:
        - name: workdir
          mountPath: "/work-dir"
      dnsPolicy: Default
      volumes:
      - name: workdir
        emptyDir: {}
    

      

  • 相关阅读:
    文档视图
    引入缓冲池技术
    数据库访问与查询
    OnInitialUpdate函数
    显示股票视图的全局函数
    切换视图的核心代码
    GuiEdit的使用
    操作方法
    SQL 使用 解析
    调用API 实现 窗体 拖动
  • 原文地址:https://www.cnblogs.com/NGU-PX/p/14235766.html
Copyright © 2020-2023  润新知