Get Started with Datadog

The Monitor

Fix Kubernetes workloads in Datadog with Kubernetes Actions

Published

Read time

6m

Fix Kubernetes workloads in Datadog with Kubernetes Actions
Jake Greenberg

Jake Greenberg

Product Manager

Allie Rittman

Allie Rittman

Senior Product Manager

Frank Spano

Frank Spano

Senior Software Engineer

When a deployment degrades or its pods enter a crash loop, teams can spot the problem and identify affected resources in the Kubernetes Explorer. But to act on that information and fix the problem, they need to leave Datadog and switch to a terminal, select the correct Kubernetes context, and run kubectl commands by hand. Moving between detection and remediation slows the response and adds room for error in an already time-sensitive situation.

Now Kubernetes Actions provides quick access to Kubernetes remediation operations in the Kubernetes Explorer, so engineers can run them without a terminal or kubectl. Engineers can restart a stuck workload, roll back a release that broke a workload, or delete a failing pod, all from the same interface where they monitor their clusters. Datadog enforces permissions based on team ownership, so teams can let engineers perform actions without giving them direct access to the cluster. Kubernetes Actions also records each action so that teams can review it later. 

In this post, we’ll show how Kubernetes Actions helps you:

Take action on Kubernetes resources without leaving Datadog

Consider a team that owns a deployment that handles checkout requests for an online store. The team ships a new release, which rolls out as a new revision of the deployment. A configuration error in the release causes the application container to exit during startup. The affected pods repeatedly restart and enter a CrashLoopBackOff state.

In the Kubernetes Explorer, the team identifies the crash-looping pods, inspects the deployment, and determines that the new revision caused the failures. Without leaving the Explorer, the on-call engineer selects Rollback from the deployment’s actions.

The engineer then selects the previous revision, compares it with the current revision, and confirms the rollback. Because the engineer’s team owns the deployment, Datadog lets the rollback proceed. Datadog shows the action’s progress until the rollback completes, and the pods recover from their crash loops.

Rollback confirmation dialog for a deployment, with a diff of the selected revision against the current one.
Rollback confirmation dialog for a deployment, with a diff of the selected revision against the current one.

With Kubernetes Actions, the team can also restart the deployment and view or delete any of its pods. Each action starts from the resource in the Explorer and runs only after the engineer confirms it.

AI agents can shorten the search for a failing resource. An engineer can ask an agent connected to the Datadog MCP Server an open-ended question, such as “Do I have any erroring pods?” and the agent’s answer can point to the crash-looping deployment, with a link to it in Datadog. Until now, that link led to a page where the engineer could see the problem but had to switch to a terminal to fix it. With Kubernetes Actions, the engineer can start the rollback from the page the agent links to.

When an engineer starts an action, Datadog sends it to the private action runner built into the Datadog Cluster Agent, which runs it inside the cluster. The runner connects out to Datadog, so no additional inbound cluster access is required. And because the Cluster Agent runs the actions, platform teams don’t need to give kubeconfig files or cluster credentials to the engineers who run actions.

Control who can act on each workload

Two controls decide who can act on a workload: a permission that determines who can run actions at all, and a team label that determines which team owns each resource. Before any action runs, Datadog checks both of these controls, so each engineer can change only the workloads their team owns. In the following screenshot, the confirmation step shows that the engineer has the Kubernetes Actions permission and that the Cluster Agent meets the requirements. The engineer can then confirm the action.

Restart confirmation dialog listing the permission and Agent requirements that must pass before the action runs.
Restart confirmation dialog listing the permission and Agent requirements that must pass before the action runs.

The Kubernetes Actions Write permission, granted through Datadog role-based access control (RBAC), determines who can run actions. The permission isn’t part of Datadog’s built-in roles, so only users who are explicitly granted it can run actions.

Each resource’s team label determines which team can change it. The label’s value is the handle of a Datadog team, and Kubernetes Actions treats that team as the resource’s owner. The label can also be applied to a namespace, which lets the owning team change any resource in it without labeling each one individually.

Kubernetes Actions also blocks actions in protected system namespaces. As a result, an action can’t proceed if:

  • The user doesn’t have the Kubernetes Actions Write permission.

  • The resource has no team label, or its label doesn’t match any Datadog team.

  • The user isn’t a member of the team that owns the resource.

  • The resource is in a protected system namespace, such as kube-system.

Users without the permission see the actions grayed out and can’t run them. In the other cases, the action fails with a permission error that names the reason, such as a missing team label or a user who isn’t a member of the owning team.

Review actions taken on your workloads

After an incident, teams need to know what changed and who changed it. Audit Trail records Kubernetes Actions so that teams can see which changes affected a workload without reconstructing which commands individual engineers ran. Each record is retained for 90 days, and users with the Kubernetes Actions Read permission can view the history.

Every entry includes:

  • Action performed: The operation, such as rolling back a deployment

  • Affected resource: The resource name, cluster, and namespace

  • Execution time: When the action was performed

  • Initiating user: Who ran the action

  • Outcome: Whether the action succeeded or failed

When the checkout team reviews the failed release the next day, the history shows who rolled back the deployment, when, and whether it worked.

Audit Trail events for Kubernetes Actions, including a restart, a rollback, and a failed pod deletion.
Audit Trail events for Kubernetes Actions, including a restart, a rollback, and a failed pod deletion.

Get started with Kubernetes Actions

With Kubernetes Actions, SREs, platform engineers, and service owners can fix failing Kubernetes workloads in the same place where they detect the problem. Datadog permissions and team ownership control who can run those operations and on which workloads, and the action history provides a record of actions for the team to review.

To enable Kubernetes Actions, configure the feature on the Datadog Cluster Agent through the Datadog Helm chart or Datadog Operator. Make sure Remote Configuration is enabled. For step-by-step setup instructions, see the Kubernetes Actions documentation.

To start using Kubernetes Actions, sign up for the Preview.

If you don’t already have a Datadog account, you can .

Start monitoring your metrics in minutes