apiVersion: apps/v1
kind: Deployment
metadata:
  name: helloworld
spec:
  replicas: 4
  selector:
    matchLabels:
      app: helloworld
  template:
    metadata:
      labels:
        app: helloworld
    spec:
      # 通过 toleration 来检测节点状态，一旦发现节点不可用，则不再置放 pod
      tolerations:
      - key: "node.kubernetes.io/unreachable"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 1
      - key: "node.kubernetes.io/not-ready"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 1
      containers:
        - name: helloworld
          # 容器镜像使用 Azure 上的 ACR 服务。
          image: snowpeak.azurecr.cn/helloworld:1.3
          ports:
          - containerPort: 80
          #健康检查，通过 httpGet 检查应用运行状态
          livenessProbe:
            httpGet:
              port: 80
              scheme: HTTP
              path: /
            # 初始化延迟 3 秒，用于应用首次启动时等待的时间，避免首次启动慢误判为失败。
            initialDelaySeconds: 10
            # 之后检查的间隔时间
            periodSeconds: 1
            # 超时多久认为是失败
            timeoutSeconds: 3
