1. 资源配额
  2. label 和 selector
  3. readinessProbe 和 livenessProbe

pod.spec.containers.readinessProbe
pod.spec.containers.livenessProbe

  1. 命令型
livenessProbe:
  exec:
	command:
	  - curl
	  - 127.0.0.1:8000
  initialDelaySeconds: 5  #第一次探测时等待5s
  periodSeconds: 5  #每5s执行一次
  failureThreshold: 2 #失败的阈值
  successThreshold: 1  #成功一次表示正常
  timeoutSeconds: 5 #  执行检查指令的超时时间
readinessProbe:
  exec:             #退出0 表示成功
	command:
	  - curl
	  - 127.0.0.1:8000  
  initialDelaySeconds: 5  #第一次探测时等待5s
  periodSeconds: 5  #每5s执行一次
  failureThreshold: 2 #失败的阈值
  successThreshold: 1  #成功的阈值
  timeoutSeconds: 3 #单次执行超时的时间
  1. http型
livenessProbe:
  httpGet:
	path: /
	port: 8000
	scheme: HTTP    # 返回200表示正常
  initialDelaySeconds: 5  #第一次探测时等待5s
  periodSeconds: 5  #每5s执行一次
  failureThreshold: 2 #失败的阈值
  successThreshold: 1  #成功的阈值
  timeoutSeconds: 3 #单次执行超时的时间 
readinessProbe:
  httpGet:
	path: /
	port: 8000
	scheme: HTTP
  initialDelaySeconds: 5  #第一次探测时等待5s
  periodSeconds: 5  #每5s执行一次
  failureThreshold: 2 #失败的阈值
  successThreshold: 1  #成功的阈值
  timeoutSeconds: 3 #单次执行超时的时间                    
  1. tcp型
   livenessProbe:
          tcpSocket:
            port: 8000
          initialDelaySeconds: 5  #第一次探测时等待5s
          periodSeconds: 5  #每5s执行一次
          failureThreshold: 2 #失败的阈值
          successThreshold: 1  #成功的阈值
          timeoutSeconds: 3 #单次执行超时的时间
        readinessProbe:
          tcpSocket:
            port: 8000
          initialDelaySeconds: 5  #第一次探测时等待5s
          periodSeconds: 5  #每5s执行一次
          failureThreshold: 2 #失败的阈值
          successThreshold: 1  #成功的阈值
          timeoutSeconds: 3 #单次执行超时的时间 
apiVersion: extensions/v1beta1  # 指定Deployment的版本 通过kubectl explain Deployment查看
kind: Deployment
metadata:
  name: test-label          # Deployment的名字
spec:
  replicas: 3               # pod副本数
  selector:
    matchLabels:
      app: web               # 选择 带有app=web的容器进行管理
  template:                  # 生成 pod 的模板
    metadata:
      labels:
        app: web             # 给pod贴的标签
    spec:
      containers:       
      - name: web
        image: python
        imagePullPolicy: IfNotPresent  # image拉取的策略  Never  Always
        ports:               # container 运行的端口
        - containerPort: 8000  
        args:
        - "python"
        - "-m"
        - "http.server"
        livenessProbe:
          httpGet:
            path: /
            port: 8000
            scheme: HTTP
          initialDelaySeconds: 5  #第一次探测时等待5s
          periodSeconds: 5  #每5s执行一次
          failureThreshold: 2 #失败的阈值
          successThreshold: 1  #成功的阈值
          timeoutSeconds: 3 #单次执行超时的时间 
        readinessProbe:
          httpGet:
            path: /
            port: 8000
            scheme: HTTP
          initialDelaySeconds: 5  #第一次探测时等待5s
          periodSeconds: 5  #每5s执行一次
          failureThreshold: 2 #失败的阈值
          successThreshold: 1  #成功的阈值
          timeoutSeconds: 3 #单次执行超时的时间