Introduction

Kubernetes Knative service is not ready when revision fails health check. This guide provides step-by-step diagnosis and resolution.

Symptoms

Typical error output:

bash
Error: operation failed
Check Kubernetes logs for details
kubectl describe <resource> <name>

Common Causes

  1. 1.This Kubernetes issue is typically caused by:
  2. 2.Misconfigured resource specifications
  3. 3.Resource constraints or quota limits
  4. 4.Network or security policy restrictions
  5. 5.Controller or operator misconfiguration

Step-by-Step Fix

Step 1: Check Current State

bash
kubectl describe <resource> <name>
kubectl logs <pod-name> -n <namespace>
kubectl get events -n <namespace> --sort-by='.lastTimestamp'

Step 2: Identify Root Cause

bash
kubectl describe <resource> <name>
kubectl logs <pod-name> -n <namespace>
kubectl get events -n <namespace> --sort-by='.lastTimestamp'

Step 3: Apply Primary Fix

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    spec:
      containers:
      - name: app
        image: my-app:latest
        resources:
          requests:
            cpu: 100m
            memory: 128Mi

Step 4: Apply Alternative Fix

```bash # Alternative fix: Check and update configuration kubectl get <resource> <name> -o yaml kubectl edit <resource> <name>

# Verify the fix kubectl get pods -n <namespace> ```

Step 5: Verify the Fix

bash
kubectl get <resource> <name> && kubectl describe <resource> <name>

Common Pitfalls

  • Missing or incorrect labels and selectors
  • Resource requests exceeding node capacity
  • Network policies blocking required traffic
  • Incorrect namespace or context

Best Practices

  • Use resource requests and limits for all containers
  • Implement proper health checks (liveness/readiness)
  • Use namespaces for resource isolation
  • Monitor cluster health regularly
  • Kubernetes Pod Stuck in Pending
  • Kubernetes CrashLoopBackOff
  • Kubernetes OOMKilled
  • Kubernetes Service No Endpoints