Câu hỏi phỏng vấn Kubernetes
Câu hỏi

Why may you have Pod is in a Pending state?

Câu trả lời

A Kubernetes pod may remain in a "Pending" state for several reasons. Here are some common causes and troubleshooting steps:

Insufficient Resources

  1. CPU or Memory Constraints: If the nodes in the cluster do not have enough CPU or memory to accommodate the pod's resource requests, the pod will remain pending. This can be diagnosed by running:

    bash Copy
    kubectl describe pod <pod-name>

    The output will often indicate if there are insufficient resources[1][4][5][8].

  2. Resource Requests and Limits: If the pod's resource requests are too high, you can either scale up the resources on the nodes or reduce the resource requests in the pod's specification[4][12].

Node Issues

  1. Node Not Ready: If the node is not in a "Ready" state, it will not schedule any new pods. You can check the node status with:

    bash Copy
    kubectl get nodes

    If a node is in a "NoSchedule" state, you can uncordon it using:

    bash Copy
    kubectl uncordon <node-name>

    This will allow new pods to be scheduled on it[2][9][17].

  2. Node Taints: Nodes can be tainted to prevent pods from being scheduled on them. You can remove a taint with:

    bash Copy
    kubectl taint nodes <node-name> <taint-key>-

    This will make the node schedulable again[9][15].

Image Pull Issues

  1. Image Pull Errors: If the container image cannot be pulled from the registry, the pod will remain in a pending state. This can be due to incorrect image names, lack of permissions, or network issues. The kubectl describe pod <pod-name> command will show image pull errors in the events section[3][12].

PersistentVolume Issues

  1. Volume Binding: If the pod requires a PersistentVolume that is not available or cannot be bound, it will remain pending. This can be checked by looking at the events in the pod description[5][8].

Network Issues

  1. Network Configuration: If the network configuration is not set up correctly, such as the pod network not being up, pods like CoreDNS will remain pending until the network is available[17].

Misconfiguration

  1. Pod Specification Errors: Errors in the pod's YAML configuration, such as incorrect image names or container ports, can prevent the pod from starting. Validating the pod specification with:
    bash Copy
    kubectl apply --validate -f <pod.yaml>

...

middle

middle

Gợi ý câu hỏi phỏng vấn

junior

What is a Pod?

expert

How do I build a High Availability (HA) cluster?

junior

What does a Pod do?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào