Skip to main content
In this guide, we explore a common Kubernetes issue—missing pods. You will learn how to deploy applications in the staging namespace and troubleshoot why the expected pods fail to start.

Deploying the API Application

We begin by creating a deployment for a simple web application named “api” in the staging namespace. The deployment manifest specifies that five replicas should run. Before applying the new deployment, inspect the current resources in the staging namespace. At this point, only one deployment, “data processor,” exists with three running pods:
Apply the API deployment with the following command:
Monitor the pods as they start up:
Even though five replicas were specified for the API deployment, only two pods are running. There are no pods in a pending or container-creating state, which suggests that node resource unavailability or taints are not the issue. The deployment is attempting to create additional pods, but three replicas remain unavailable.

Investigating the Deployment Status

Gather more details by describing the deployment:
The events reveal that the deployment controller scaled the replica set to five, but there is an error related to resource quotas. A closer look at the events shows the following error:
This error indicates that the “pod-quota” resource quota is capping the number of pods in the staging namespace at five. Since there are already five pods running (including those from the data processor deployment), the API deployment cannot create additional pods.

Adjusting the Namespace Resource Quota

First, confirm the existing resource quota for the staging namespace:
To support additional deployments, consider increasing the pod quota in the namespace.
Edit the resource quota to raise the hard limit—for example, to 10 pods:
Update the manifest as shown below:
After updating the quota, restart the API deployment to initiate the creation of the additional pods:
Verify that new pods are created by listing them:
The older pods are terminating as the new ones come up, and eventually, five API pods are running.

Deploying the Analytics Application

Next, deploy another web application, “analytics,” with a single replica. With the updated namespace quota, this deployment should not encounter quota issues. The deployment manifest is as follows:
Apply the deployment:
Monitor the pods:
However, the analytics pod does not appear to be created. Describing the deployment indicates that the desired replica is unavailable:
Event logs further indicate an error related to the service account:
Examine the service accounts in the staging namespace:
Since the service account “analytics-service-account” is missing, create it using the following command:
Restart the analytics deployment to apply the changes:
Check the pods again to verify that the analytics pod is created:
After a short period, the analytics pod transitions from ContainerCreating to Running.

Conclusion

In this guide, we addressed two common issues that can lead to missing pods in a Kubernetes cluster:
  1. A resource quota that restricts the creation of new pods in a namespace.
  2. A missing dependency—in this case, a required service account.
  • Check resource quotas imposed on the namespace if pods are not being created as expected.
  • Verify that all required service accounts and other dependencies are present.
  • Use “kubectl describe” to access detailed event logs and error messages.
By increasing the pod quota and creating the missing service account, the deployments functioned as intended, ensuring proper pod creation in the staging namespace. For more in-depth Kubernetes troubleshooting, consider reviewing the Kubernetes Documentation for additional best practices.

Watch Video