Kubernetes
Kubernetes, and Solutions.
CrashLoopBackOff
: Pod CrashLoopBackOff,
:, K8s. :, OOM, command
Solutions:
- kubectl logs <pod> --previous
- kubectl describe pod <pod> Events and (Exit Code)
- Exit Code 1:, and
- Exit Code 137: OOM, memory limits
- Exit Code 0: K8s, command
- and ConfigMap/Secret
- (, Redis and more)
: resources.limits OOM; initContainer and more; startupProbe
ImagePullBackOff / ErrImagePull
: Pod
:. : tag,,
Solutions:
- kubectl describe pod <pod>
- and tag : docker pull <image>
- imagePullSecret: kubectl create secret docker-registry regcred --docker-server=xxx --docker-username=xxx --docker-password=xxx
- Pod spec secret: spec.imagePullSecrets[].name: regcred
- latest tag, imagePullPolicy
: tag latest; imagePullSecret ServiceAccount Pod ;
Pod Pending
: Pod Pending,
:. : (CPU/), Pod, nodeSelector/affinity, PVC
Solutions:
- kubectl describe pod <pod> Events
- : kubectl top nodes, requests
- : kubectl describe nodes | grep Taints, tolerations
- : nodeSelector nodeAffinity
- PVC : kubectl get pvc PVC, StorageClass and PV
- ResourceQuota
: requests and limits, ;; Cluster Autoscaler
OOMKilled (Exit Code 137)
:
:resources.limits.memory, Linux OOM Killer
Solutions:
- kubectl describe pod <pod> Last State OOMKilled
- kubectl top pod <pod> --containers
- memory limits:
- :
- Java : JVM (-Xmx) container limits
- Node.js : --max-old-space-size limits
: limits;limits 1.5-2 ; OOM
NodeNotReady
: NotReady, Pod
:kubelet API Server. :, kubelet, (//PID)
Solutions:
- kubectl describe node <node> Conditions and Events
- SSH kubelet : systemctl status kubelet
- kubelet : journalctl -u kubelet --since '5 minutes ago'
- : df -h(), free -m(), PID
- : docker system prune crictl rmi --prune
- kubelet: systemctl restart kubelet
: and (//CPU); and ; eviction threshold Pod;