Kubernetes
Helm
Jenkins
Deployment
Troubleshooting

server could not find the requested resource get pods error when deploying Helm chart using Jenkins

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

When deploying Helm charts using Jenkins, you might encounter the error "server could not find the requested resource (get pods)." This error typically occurs during the interaction between Jenkins, Helm, and Kubernetes. Understanding the root cause of this issue involves examining how these tools interact with each other and how Kubernetes API handles requests.

Understanding the Error

The error message "server could not find the requested resource (get pods)" indicates that a request was made to the Kubernetes API server to retrieve pod information, but the server could not find the specified resource. This error can arise from several potential issues:

  • Incorrect Kubernetes Context: The context provided might not be targeting the correct Kubernetes cluster.
  • Permissions or RBAC issues: The Jenkins or Helm instance may lack the necessary permissions to access the requested resource within the cluster.
  • API Version Mismatch: The Helm chart or Kubernetes API request may reference outdated or deprecated API versions.
  • Network Issues: Connectivity problems between Jenkins, Kubernetes, and any involved third-party services can also result in this error.

Deployment Scenario with Jenkins and Helm

Here’s how a typical deployment pipeline might look:

  1. Checkout Code: Jenkins pulls the desired Helm chart and application code from the version control server (e.g., GitHub).
  2. Build and Package: Jenkins might build a Docker image and push it to a container registry.
  3. Configuration and Deployment: Jenkins calls Helm to install or upgrade the chart in a Kubernetes cluster, often using a `kubectl` command to get the status of pods.
  4. Verification: Jenkins verifies the deployment by fetching the status of resources like pods.

Troubleshooting the Error

1. Verify Kubernetes Context

Ensure that the Kubernetes context used by Jenkins is correct and points to the intended cluster. You can test this locally using the `kubectl` command:

  • kind: ServiceAccount
  • For Pods: Use the `v1` API.

Course illustration
Course illustration

All Rights Reserved.