• Kubernetes Submit Queue's avatar
    Merge pull request #46371 from sjenning/fix-liveness-probe-reset · b641aedc
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue
    
    reset resultRun on pod restart
    
    xref https://bugzilla.redhat.com/show_bug.cgi?id=1455056
    
    There is currently an issue where, if the pod is restarted due to liveness probe failures exceeding failureThreshold, the failure count is not reset on the probe worker.  When the pod restarts, if the liveness probe fails even once, the pod is restarted again, not honoring failureThreshold on the restart.
    
    ```yaml
    apiVersion: v1
    kind: Pod
    metadata:
      name: busybox
    spec:
      containers:
      - name: busybox
        image: busybox
        command:
        - sleep
        - "3600"
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 3
          timeoutSeconds: 1
          periodSeconds: 3
          successThreshold: 1
          failureThreshold: 5
      terminationGracePeriodSeconds: 0
    ```
    
    Before this PR:
    ```
    $ kubectl create -f busybox-probe-fail.yaml 
    pod "busybox" created
    $ kubectl get pod -w
    NAME      READY     STATUS    RESTARTS   AGE
    busybox   1/1       Running   0          4s
    busybox   1/1       Running   1         24s
    busybox   1/1       Running   2         33s
    busybox   0/1       CrashLoopBackOff   2         39s
    ```
    
    After this PR:
    ```
    $ kubectl create -f busybox-probe-fail.yaml
    $ kubectl get pod -w
    NAME      READY     STATUS              RESTARTS   AGE
    busybox   0/1       ContainerCreating   0          2s
    busybox   1/1       Running   0         4s
    busybox   1/1       Running   1         27s
    busybox   1/1       Running   2         45s
    ```
    
    ```release-note
    Fix kubelet reset liveness probe failure count across pod restart boundaries
    ```
    
    Restarts are now happen at even intervals.
    
    @derekwaynecarr
    b641aedc
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
staging Loading commit data...
test Loading commit data...
third_party Loading commit data...
translations Loading commit data...
vendor Loading commit data...
.bazelrc Loading commit data...
.gazelcfg.json Loading commit data...
.generated_files Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
BUILD.bazel Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
OWNERS Loading commit data...
OWNERS_ALIASES Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
WORKSPACE Loading commit data...
code-of-conduct.md Loading commit data...
labels.yaml Loading commit data...