Logo: Health Probes

Health Probes

Organisatioun
RedHatProductSecurity
health-probes

Configure Kubernetes health probes, lifecycle hooks, and termination policies. Use when writing, reviewing, or auditing pod specs, Deployments, StatefulSets, or Helm templates that define liveness, readiness, startup probes, postStart/preStop hooks, or terminationMessagePolicy.

Iwwersiicht

EditeurRedHatProductSecurity
Repositoryprodsec-skills
Skill-Nummhealth-probes
Stären
56
Forks
9
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    RedHatProductSecurity huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Health Probes an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/module/skills/health-probes
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RedHatProductSecurity/prodsec-skills.git /tmp/prodsec-skills
mkdir -p .claude/skills
cp -r /tmp/prodsec-skills/module/skills/health-probes .claude/skills/health-probes
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Health Probes an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Health Probes automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Health Probes net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Health Probes and Lifecycle Management

Kubernetes uses health probes to determine when to restart a container, when to route traffic to a pod, and when a slow-starting application is ready. Lifecycle hooks provide initialization and graceful shutdown control. Together they enable self-healing workloads that recover from pod, host, and network failures.

Probe Types

Every container should define all three probe types:

ProbePurposeFailure Action
LivenessDetects deadlocks and hangs after the application is runningRestarts the container
ReadinessDetermines when a container can accept trafficRemoves the pod from Service endpoints
StartupProtects slow-starting containers from premature liveness killsDisables liveness/readiness checks until the app starts

Required for: Telco (mandatory), Far-Edge (mandatory), Extended (mandatory), Non-Telco (optional)

Without startup probes, slow-starting applications require large initialDelaySeconds on liveness probes, which delays failure detection after the application is running.

Probe Mechanisms

Choose the mechanism that best fits the application:

httpGet (Preferred for HTTP Services)

yaml
livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10
  timeoutSeconds: 3
  failureThreshold: 3

Returns success for any HTTP status 200-399.

tcpSocket

yaml
readinessProbe:
  tcpSocket:
    port: 5432
  initialDelaySeconds: 5
  periodSeconds: 10

Use for non-HTTP services (databases, message brokers) where opening a TCP connection confirms the service is listening.

grpc

yaml
livenessProbe:
  grpc:
    port: 50051
    service: health
  periodSeconds: 10

Requires Kubernetes 1.27+ and the application must implement the gRPC Health Checking Protocol.

exec

Warning: Exec probes have strict performance constraints. See Exec Probe Performance Constraints before using this mechanism.

yaml
livenessProbe:
  exec:
    command:
      - /bin/sh
      - -c
      - pg_isready -U postgres
  periodSeconds: 15
  timeoutSeconds: 5

Runs a command inside the container. Success is exit code 0. Prefer httpGet or tcpSocket when possible — exec probes fork a process, which adds latency and CPU overhead.

Configuration Best Practices

ParameterGuidance
initialDelaySecondsUse startup probes instead of large values here; keep low (0-10s) when a startup probe is present
periodSecondsMust be >= 10 for exec probes; 10-30s is typical for all probe types
timeoutSecondsShould be shorter than periodSeconds; 1-5s is typical
failureThreshold3 is the default; increase for applications with occasional slow responses
successThresholdMust be 1 for liveness and startup probes; can be higher for readiness

Example: Well-Configured Container

yaml
containers:
  - name: app
    image: registry.example.com/app:v1.2.3
    ports:
      - containerPort: 8080
    startupProbe:
      httpGet:
        path: /healthz
        port: 8080
      periodSeconds: 5
      failureThreshold: 30     # allows up to 150s for startup
    livenessProbe:
      httpGet:
        path: /healthz
        port: 8080
      periodSeconds: 10
      timeoutSeconds: 3
      failureThreshold: 3
    readinessProbe:
      httpGet:
        path: /ready
        port: 8080
      periodSeconds: 5
      timeoutSeconds: 3
      failureThreshold: 3
    terminationMessagePolicy: FallbackToLogsOnError

Lifecycle Hooks

Lifecycle hooks run code at container startup and shutdown without requiring changes to the application itself.

Required for: Telco (mandatory), Far-Edge (mandatory), Extended (mandatory), Non-Telco (optional)

PostStart

Runs immediately after the container is created. Kubernetes does not change the container state to Running until the PostStart handler completes successfully.

yaml
lifecycle:
  postStart:
    exec:
      command:
        - /bin/sh
        - -c
        - /app/init.sh

Use PostStart to:

  • Verify required APIs or dependencies are available
  • Register the instance with a service registry
  • Run database migrations or schema checks

PreStop

Runs immediately before the container receives SIGTERM. The container is not terminated until the PreStop handler completes (up to terminationGracePeriodSeconds).

yaml
lifecycle:
  preStop:
    exec:
      command:
        - /bin/sh
        - -c
        - sleep 5 && /app/drain.sh

Use PreStop to:

  • Drain active connections and in-flight requests
  • Deregister from service registries or load balancers
  • Flush buffers, close database connections, release locks
  • Allow time for endpoint propagation (the sleep pattern above gives kube-proxy time to update iptables rules before the application stops accepting connections)

Exec Probe Performance Constraints

Exec probes fork a process inside the container on every probe interval. For latency-sensitive and performance-critical workloads, this overhead can cause unacceptable jitter.

CPU-Pinned Workloads

Workloads with CPU pinning (Guaranteed QoS with exclusive CPUs) must not use exec probes. Use httpGet or tcpSocket instead.

Required for: Telco (mandatory), Far-Edge (mandatory), Extended (mandatory), Non-Telco (optional)

Why: Exec probes spawn a process that competes for the pinned CPUs, interrupting latency-sensitive operations and degrading deterministic scheduling guarantees.

Real-Time Applications

Containers running real-time applications must not use exec probes.

Required for: Far-Edge (mandatory), all others (optional)

Why: Process forking causes latency spikes that violate real-time scheduling constraints.

Cluster-Wide Exec Probe Limits

Limit exec probes to fewer than 10 across the entire workload in a cluster. Each exec probe must have periodSeconds >= 10.

Required for: all profiles (optional, recommended best practice)

Why: Excessive exec probes consume system resources and can degrade overall cluster performance in resource-constrained environments.

Termination Message Policy

Set terminationMessagePolicy: FallbackToLogsOnError on all containers. This ensures that when a container exits with an error, Kubernetes captures the last chunk of the container's log output as the termination message, making failure diagnosis possible without external log aggregation.

Required for: Telco (mandatory), Far-Edge (mandatory), Extended (mandatory), Non-Telco (optional)

yaml
containers:
  - name: app
    image: registry.example.com/app:v1.2.3
    terminationMessagePolicy: FallbackToLogsOnError

The default policy (File) only reads from /dev/termination-log, which most applications do not write to, resulting in empty termination messages on failure.

Implementation Checklist

  • All containers define a liveness probe
  • All containers define a readiness probe
  • All containers define a startup probe
  • periodSeconds is >= 10 for all exec probes
  • CPU-pinned workloads (Guaranteed QoS with exclusive CPUs) do not use exec probes
  • Real-time applications do not use exec probes
  • Fewer than 10 exec probes are configured cluster-wide for the workload
  • PostStart hooks are configured for initialization logic
  • PreStop hooks are configured for graceful shutdown
  • terminationMessagePolicy: FallbackToLogsOnError is set on all containers
  • Probe timeouts and thresholds are tuned for the application's startup and response characteristics

Certsuite Test Mapping

GuidanceCertsuite Test IDProfiles
Liveness probe requiredlifecycle-liveness-probeTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional
Readiness probe requiredlifecycle-readiness-probeTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional
Startup probe requiredlifecycle-startup-probeTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional
PostStart hook configuredlifecycle-container-poststartTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional
PreStop hook configuredlifecycle-container-prestopTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional
No exec probes on CPU-pinned workloadsperformance-cpu-pinning-no-exec-probesTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional
Exec probe count and period limitsperformance-max-resources-exec-probesAll profiles: optional
No exec probes on real-time appsperformance-rt-apps-no-exec-probesFar-Edge: mandatory, all others: optional
Termination message policyobservability-termination-policyTelco: mandatory, Far-Edge: mandatory, Extended: mandatory, Non-Telco: optional

References

Heefeg gestallte Froen

Wat mécht de KI-Skill Health Probes?

Configure Kubernetes health probes, lifecycle hooks, and termination policies. Use when writing, reviewing, or auditing pod specs, Deployments, StatefulSets, or Helm templates that define liveness, readiness, startup probes, postStart/preStop hooks, or terminationMessagePolicy.

Firwat Health Probes op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Health Probes besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Health Probes an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/module/skills/health-probes an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Health Probes benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Health Probes benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Health Probes domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Health Probes gratis?

Jo. RedHatProductSecurity huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇