Kubernetes

Kubernetes, and Solutions.

CrashLoopBackOff

: Pod CrashLoopBackOff,

:, K8s. :, OOM, command

Solutions:

  1. kubectl logs <pod> --previous
  2. kubectl describe pod <pod> Events and (Exit Code)
  3. Exit Code 1:, and
  4. Exit Code 137: OOM, memory limits
  5. Exit Code 0: K8s, command
  6. and ConfigMap/Secret
  7. (, Redis and more)

: resources.limits OOM; initContainer and more; startupProbe

ImagePullBackOff / ErrImagePull

: Pod

:. : tag,,

Solutions:

  1. kubectl describe pod <pod>
  2. and tag : docker pull <image>
  3. imagePullSecret: kubectl create secret docker-registry regcred --docker-server=xxx --docker-username=xxx --docker-password=xxx
  4. Pod spec secret: spec.imagePullSecrets[].name: regcred
  5. latest tag, imagePullPolicy

: tag latest; imagePullSecret ServiceAccount Pod ;

Pod Pending

: Pod Pending,

:. : (CPU/), Pod, nodeSelector/affinity, PVC

Solutions:

  1. kubectl describe pod <pod> Events
  2. : kubectl top nodes, requests
  3. : kubectl describe nodes | grep Taints, tolerations
  4. : nodeSelector nodeAffinity
  5. PVC : kubectl get pvc PVC, StorageClass and PV
  6. ResourceQuota

: requests and limits, ;; Cluster Autoscaler

OOMKilled (Exit Code 137)

:

:resources.limits.memory, Linux OOM Killer

Solutions:

  1. kubectl describe pod <pod> Last State OOMKilled
  2. kubectl top pod <pod> --containers
  3. memory limits:
  4. :
  5. Java : JVM (-Xmx) container limits
  6. Node.js : --max-old-space-size limits

: limits;limits 1.5-2 ; OOM

NodeNotReady

: NotReady, Pod

:kubelet API Server. :, kubelet, (//PID)

Solutions:

  1. kubectl describe node <node> Conditions and Events
  2. SSH kubelet : systemctl status kubelet
  3. kubelet : journalctl -u kubelet --since '5 minutes ago'
  4. : df -h(), free -m(), PID
  5. : docker system prune crictl rmi --prune
  6. kubelet: systemctl restart kubelet

: and (//CPU); and ; eviction threshold Pod;