-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pod health | restart loop & not ready (#75)
* feat: pod health | restart loop & not ready * Update pkg/health/health_pod.go Co-authored-by: Moshe Immerman <moshe@flanksource.com> * feat: container readiness probe waiting --------- Co-authored-by: Moshe Immerman <moshe@flanksource.com>
- Loading branch information
1 parent
9680abe
commit 1916ba9
Showing
5 changed files
with
362 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
pkg/health/testdata/pod-not-ready-but-container-ready.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
uid: d21e1521-5a3f-4120-a446-bd7426199a20 | ||
name: postgresql-01902bbe-eb40-47d4-a0f7-0afb993645dc-0 | ||
labels: | ||
app: postgresql | ||
controller-revision-hash: postgresql-01902bbe-eb40-47d4-a0f7-0afb993645dc-988f9fc65 | ||
statefulset.kubernetes.io/pod-name: postgresql-01902bbe-eb40-47d4-a0f7-0afb993645dc-0 | ||
namespace: httpbin | ||
generateName: postgresql-01902bbe-eb40-47d4-a0f7-0afb993645dc- | ||
ownerReferences: | ||
- uid: da460101-eebb-4d4f-b8f4-acb8908d7083 | ||
kind: StatefulSet | ||
name: postgresql-01902bbe-eb40-47d4-a0f7-0afb993645dc | ||
apiVersion: apps/v1 | ||
controller: true | ||
blockOwnerDeletion: true | ||
creationTimestamp: 2024-06-18T14:48:55Z | ||
spec: | ||
restartPolicy: Always | ||
readiness: | ||
initialDelaySeconds: 10 | ||
containers: | ||
- name: busybox | ||
image: busybox | ||
command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600'] | ||
restartPolicy: Always | ||
resources: | ||
requests: | ||
memory: "64Mi" | ||
cpu: "250m" | ||
limits: | ||
memory: "128Mi" | ||
cpu: "500m" | ||
|
||
nodeName: some-node | ||
status: | ||
phase: Running | ||
podIP: 10.0.179.6 | ||
hostIP: 10.0.179.6 | ||
podIPs: | ||
- ip: 10.0.179.6 | ||
hostIPs: | ||
- ip: 10.0.179.6 | ||
qosClass: BestEffort | ||
startTime: 2024-07-17T06:58:33Z | ||
conditions: | ||
- type: PodReadyToStartContainers | ||
status: 'True' | ||
- type: Initialized | ||
status: 'True' | ||
- type: Ready | ||
status: 'False' | ||
- type: ContainersReady | ||
status: 'True' | ||
- type: PodScheduled | ||
status: 'True' | ||
containerStatuses: | ||
- name: eks-pod-identity-agent | ||
image: 602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/eks-pod-identity-agent:0.1.10 | ||
ready: true | ||
state: | ||
running: | ||
startedAt: 2024-07-17T06:58:43Z | ||
imageID: 602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/eks-pod-identity-agent@sha256:9cf48154b1603963d449f80ed8bc150918509ac025e92cdd67748a9f3f8ad367 | ||
started: true | ||
lastState: {} | ||
containerID: containerd://8e48835f5f3765827aed1470ef5a95312345c52a1a5c3db24ff800c8e10a6424 | ||
restartCount: 0 | ||
initContainerStatuses: | ||
- name: eks-pod-identity-agent-init | ||
image: 602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/eks-pod-identity-agent:0.1.10 | ||
ready: true | ||
state: | ||
terminated: | ||
reason: Completed | ||
exitCode: 0 | ||
startedAt: 2024-07-17T06:58:37Z | ||
finishedAt: 2024-07-17T06:58:37Z | ||
containerID: containerd://16032f42f71448ef31794b6805cb69f25cc4e59fd83622d3fa9b3acd00a3867c | ||
imageID: 602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/eks-pod-identity-agent@sha256:9cf48154b1603963d449f80ed8bc150918509ac025e92cdd67748a9f3f8ad367 | ||
started: false | ||
lastState: {} | ||
containerID: containerd://16032f42f71448ef31794b6805cb69f25cc4e59fd83622d3fa9b3acd00a3867c | ||
restartCount: 0 |
123 changes: 123 additions & 0 deletions
123
pkg/health/testdata/pod-not-ready-container-not-ready.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
creationTimestamp: '2024-07-29T06:32:55Z' | ||
generateName: nginx-deployment-559c4fc45b- | ||
labels: | ||
app: nginx | ||
pod-template-hash: 559c4fc45b | ||
name: nginx-deployment-559c4fc45b-xdlmh | ||
namespace: default | ||
ownerReferences: | ||
- apiVersion: apps/v1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: ReplicaSet | ||
name: nginx-deployment-559c4fc45b | ||
uid: 28b8d6dd-1ffe-4ede-8e24-0bafa3bb71e3 | ||
resourceVersion: '68571321' | ||
uid: 9d304944-d50a-4b8a-971a-7fcad1a4ca9f | ||
spec: | ||
containers: | ||
- image: nginx:alpine | ||
imagePullPolicy: IfNotPresent | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: / | ||
port: 80 | ||
scheme: HTTP | ||
initialDelaySeconds: 300 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
timeoutSeconds: 1 | ||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 128Mi | ||
terminationMessagePath: /dev/termination-log | ||
terminationMessagePolicy: File | ||
volumeMounts: | ||
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount | ||
name: kube-api-access-ssdbh | ||
readOnly: true | ||
dnsPolicy: ClusterFirst | ||
enableServiceLinks: true | ||
nodeName: saka | ||
preemptionPolicy: PreemptLowerPriority | ||
priority: 0 | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
serviceAccount: default | ||
serviceAccountName: default | ||
terminationGracePeriodSeconds: 30 | ||
tolerations: | ||
- effect: NoExecute | ||
key: node.kubernetes.io/not-ready | ||
operator: Exists | ||
tolerationSeconds: 300 | ||
- effect: NoExecute | ||
key: node.kubernetes.io/unreachable | ||
operator: Exists | ||
tolerationSeconds: 300 | ||
volumes: | ||
- name: kube-api-access-ssdbh | ||
projected: | ||
defaultMode: 420 | ||
sources: | ||
- serviceAccountToken: | ||
expirationSeconds: 3607 | ||
path: token | ||
- configMap: | ||
items: | ||
- key: ca.crt | ||
path: ca.crt | ||
name: kube-root-ca.crt | ||
- downwardAPI: | ||
items: | ||
- fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
path: namespace | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2024-07-29T06:32:55Z' | ||
status: 'True' | ||
type: Initialized | ||
- lastTransitionTime: '2024-07-29T06:32:55Z' | ||
message: 'containers with unready status: [nginx]' | ||
reason: ContainersNotReady | ||
status: 'False' | ||
type: Ready | ||
- lastTransitionTime: '2024-07-29T06:32:55Z' | ||
message: 'containers with unready status: [nginx]' | ||
reason: ContainersNotReady | ||
status: 'False' | ||
type: ContainersReady | ||
- lastTransitionTime: '2024-07-29T06:32:55Z' | ||
status: 'True' | ||
type: PodScheduled | ||
containerStatuses: | ||
- containerID: containerd://01d5d0ded389b8dffa95f85fc8cb9a8a1bf916beae74a75dd7a62bc10dabef01 | ||
image: docker.io/library/nginx:alpine | ||
imageID: docker.io/library/nginx@sha256:208b70eefac13ee9be00e486f79c695b15cef861c680527171a27d253d834be9 | ||
lastState: {} | ||
name: nginx | ||
ready: false | ||
restartCount: 0 | ||
started: true | ||
state: | ||
running: | ||
startedAt: '2024-07-29T06:32:56Z' | ||
hostIP: 10.99.99.8 | ||
phase: Running | ||
podIP: 10.42.2.27 | ||
podIPs: | ||
- ip: 10.42.2.27 | ||
qosClass: BestEffort | ||
startTime: '2024-07-29T06:32:55Z' |
Oops, something went wrong.