Execute Kubernetes Manifest

Overview

The Execute Kubernetes Manifest action allows users to execute Kubernetes commands (kubectl) that directly operate on YAML manifest files within a specified Kubernetes cluster. This action is particularly useful for applying, creating, deleting, or replacing resources based on provided or AI-generated Kubernetes manifests. It enables users to perform quick actions on their clusters related to security and other critical operations, making it ideal for managing, securing, and deploying configurations directly from the bot workflow.

Prerequisites

  1. Agent Configuration:
    Ensure the Linux Agent is configured. Refer to the Agent Installation Guide.
  2. kubectl CLI installed on the Linux agent. You can refer to the official installation guide for setup instructions.
  3. Access to the target Kubernetes cluster.

How to Use This Action?

To use the Execute Kubernetes Manifest action, follow these steps:

  • In your bot workflow, navigate to Linux Actions under the Library section.

    Navigate to Kubernetes Action

  • Search for Execute Kubernetes Manifest and drag it into your workflow.

  • Select the integration connected to the agent for executing kubectl manifest commands.

  • Under the Parameters section, specify the required parameter values. For details on additional parameters, refer to the Parameter Details section.

  • Entering Command and Manifest Options:

    1. Manual Entry: You can manually enter kubernetes_manifest YAML. Manual Entry Screenshot

    2. AI Assistance: Alternatively, use AI to generate the manifest YAML based on your inputs. AI Assistance Screenshot

    3. Provide Command: Specify the desired kubectl command to run, such as apply, create, delete, or replace. Ensure to include any appropriate flags needed for the command, except for -f, which is managed by the action itself.

  • Save or update the bot, then click on Run to execute the bot. View the results in the execution details to confirm successful execution or troubleshoot if there are any errors.

Parameter Details

ParameterRequiredDescription
kubectl_commandYesSpecifies the kubectl command to execute on the manifest. Supports commands like apply, create, delete, and replace. JSON output is added if supported.
kubernetes_manifestYesThe YAML manifest file content defining Kubernetes resources to manage.
kubeconfig_pathNoPath to the Kubernetes configuration file on the agent, if different from the default ~/.kube/config.
run_as_userYesThe user under which the command will execute (default is ubuntu).
execution_timeoutYesMaximum allowed time (in seconds) for command execution (default is 900).

Example Use Case

Scenario: Apply a Deployment Manifest to Address a Security Patch

Suppose you need to deploy a new application or apply a security patch in your Kubernetes cluster. Using the Execute Kubernetes Manifest action, you can create or apply the deployment resources defined in your manifest file, ensuring that updates for security configurations or application deployments are done swiftly.

Example kubectl_command:

kubectl apply --context=eks-staging-cluster --namespace=my-app-staging