0Pricing
Docker & Kubernetes for Developers · レッスン

ヘルスチェック:Liveness、Readiness、Startup Probe

KubernetesのProbeを使って異常なコンテナを検出し、アプリの準備が整うまでトラフィックを制御し、起動に時間がかかるアプリの立ち上がりを待てるようにします。

「ヘルスチェック:Liveness、Readiness、Startup Probe」はCoddyKit上の無料Docker & Kubernetes for Developersレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDocker & Kubernetes for Developers学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Docker & Kubernetes for Developersコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Why Probes Matter

Kubernetes cannot know your app is healthy just because the process is running. Probes let you tell the kubelet how to check real application health.

The Three Probe Types

There are three: liveness (restart if broken), readiness (gate traffic), and startup (protect slow boots).

Liveness Probe

If the liveness probe fails, the kubelet restarts the container. Use it to recover from deadlocks the process cannot detect itself.

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 10

Readiness Probe

If readiness fails, the Pod is removed from Service endpoints but NOT restarted. This stops traffic to a Pod that is temporarily unable to serve.

readinessProbe:
  httpGet:
    path: /ready
    port: 8080
  periodSeconds: 5

Liveness vs Readiness

Liveness answers should I restart this; readiness answers should I send traffic. Using readiness as liveness causes needless restarts; the opposite causes failed requests.

Startup Probe

A startup probe disables liveness and readiness until the app finishes booting, perfect for slow-starting legacy apps.

startupProbe:
  httpGet:
    path: /healthz
    port: 8080
  failureThreshold: 30
  periodSeconds: 10

Probe Mechanisms

Probes can use httpGet, a raw tcpSocket connection, or run a command with exec, succeeding when the command exits 0.

livenessProbe:
  exec:
    command: ["cat", "/tmp/healthy"]

Tuning Timing

Key knobs: initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, and successThreshold let you balance speed of detection against false positives.

Probes and Rollouts

Readiness probes make rolling updates safe: new Pods only receive traffic once ready, so a broken release does not serve users.

Debugging Failing Probes

Probe failures show up in events. Describe the Pod to see why it restarts or never becomes ready.

kubectl describe pod my-pod

Common Mistakes

Avoid heavy health endpoints that themselves cause timeouts, and avoid too-short initialDelaySeconds that restart Pods before they finish booting.

Quick Check

Test what you have learned.

Recap

You learned the three probe types: liveness restarts, readiness gates traffic, startup protects slow boots, the http/tcp/exec mechanisms, timing knobs, and how readiness keeps rollouts safe.

よくある質問

「ヘルスチェック:Liveness、Readiness、Startup Probe」レッスンは無料ですか?

はい。「ヘルスチェック:Liveness、Readiness、Startup Probe」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Docker & Kubernetes for Developersコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Docker & Kubernetes for Developersコースには全4レッスンが含まれています。

「ヘルスチェック:Liveness、Readiness、Startup Probe」で何を学びますか?

KubernetesのProbeを使って異常なコンテナを検出し、アプリの準備が整うまでトラフィックを制御し、起動に時間がかかるアプリの立ち上がりを待てるようにします。 ブラウザで直接実行するハンズオンコードでDocker & Kubernetes for Developersを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Docker & Kubernetes for Developersを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDocker & Kubernetes for Developersは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「ヘルスチェック:Liveness、Readiness、Startup Probe」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDocker & Kubernetes for Developersレッスンでコードを書いて実行できますか?

はい。すべてのDocker & Kubernetes for Developersレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Kubernetesのログ記録戦略
  2. PrometheusとGrafanaによる監視
  3. K8sの一般的な問題のトラブルシューティング
  4. ヘルスチェック:Liveness、Readiness、Startup Probe
← Docker & Kubernetes for Developersに戻る