Skip to content

Commit

Permalink
docs: clusterContainerStatuses analyzer (#597)
Browse files Browse the repository at this point in the history
* new doc for container status analyzer

* style fix

* add restart count to sample spec
  • Loading branch information
nvanthao authored Dec 4, 2024
1 parent e631f7a commit b82d63e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module.exports = {
"analyze/ceph-status",
"analyze/certificates",
"analyze/cluster-pod-statuses",
"analyze/cluster-container-statuses",
"analyze/cluster-resource",
"analyze/cluster-version",
"analyze/container-runtime",
Expand Down
40 changes: 40 additions & 0 deletions docs/source/analyze/cluster-container-statuses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Cluster Container Statuses
description: Detecting Kubernetes containers with certain statuses
---

The `clusterContainerStatuses` analyzer is used to detect containers that have a certain status. It complements the existing [clusterPodStatuses analyzer](./cluster-pod-statuses) by allowing you to detect containers that are unhealthy.
The `when` attribute supports standard comparators to compare the status of the container.

The `clusterContainerStatuses` analyzer uses data from the [clusterResources collector](https://troubleshoot.sh/collect/cluster-resources).
The `clusterResources` collector is automatically added and will always be present.

The outcomes on this analyzer will be processed in order for each container of each pod, and execution will stop after the first outcome that is truthy.

## Parameters

**namespaces**: (Optional) The namespaces to look for the pods in. If not specified, it will default to all namespaces.

**restartCount**: (Optional) Only consider containers with a restart count greater than or equal to this value.

## Example Analyzer Definition

```yaml
apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
name: container-statuses
spec:
analyzers:
- clusterContainerStatuses:
checkName: oom-detector
namespaces:
- default
restartCount: 1
outcomes:
- fail:
when: "== OOMKilled"
message: "Container {{ .ContainerName }} from pod {{ .Namespace }}/{{ .PodName }} has OOMKilled"
- pass:
message: "No OOMKilled containers found"
```

0 comments on commit b82d63e

Please sign in to comment.