Home > Archives > Health Check示例

Health Check示例

Publish:

# my-deployment-with-health-checks.yaml
apiVersion: apps/v1beta2 # for kubectl versions >= 1.9.0 use apps/v1
kind: Deployment
metadata:
  name: hello-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-deployment
  template:
    metadata:
      labels:
        app: my-deployment
    spec:
      containers:
      - name: webapp
        image: baoguoding/demo
        ports:
        - name: webapp-port
          containerPort: 3000
        livenessProbe:
          httpGet:
            path: /
            port: webapp-port
          initialDelaySeconds: 15
          periodSeconds: 15
          timeoutSeconds: 30
          successThreshold: 1
          failureThreshold: 3

kubectl create -f my-deployment-with-health-checks.yaml
kubectl get deploy
kubectl describe deploy hello-deployment

参考

声明: 本文采用 BY-NC-SA 授权。转载请注明转自: Ding Bao Guo