daemonset pod 的高可用程度分析

60 阅读1分钟

目前在调研静态 pod 和 daemonset pod 的高可用程度

经过测试发现: daemonset pod 在控制面: etcd kube-api 挂掉的情况下,且 pod 所在 node 重启滞后,pod 容器无法启动。 虽然,kubelet 会缓存一些东西,但是不足以启动 pod

测试模板:


? cat netshoot-ds.yaml 
apiVersion: apps/v1  
kind: DaemonSet  
metadata:  
  name: netshoot-http-server  
spec:  
  selector:  
    matchLabels:  
      app: netshoot-http-server 
  template:  
    metadata:  
      labels:  
        app: netshoot-http-server  
    spec:  
      hostNetwork: true
      containers:  
      - name: netshoot-http-server  
        image: docker.io/nicolaka/netshoot:latest
        imagePullPolicy: Never
        command: ["sh", "-c"]  
        args:  
          - cd /tmp && python3 -m http.server 8080  
        ports:  
        - containerPort: 8080  
        livenessProbe:   
          tcpSocket:  
            port: 8080   
          initialDelaySeconds: 10  
          periodSeconds: 10   
          timeoutSeconds: 2   
          failureThreshold: 3  
          successThreshold: 1 
        readinessProbe:   
          tcpSocket:  
            port: 8080   
          initialDelaySeconds: 5   
          periodSeconds: 10  
          timeoutSeconds: 2   
          successThreshold: 1   
          failureThreshold: 3   
      restartPolicy: Always 


测试过程,基于 kind 启动一个控制面的 k8s 集群,直接删除控制面

测试结果:

image.png