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
- kubectl CLI installed on the Linux agent. You can refer to the official installation guide for setup instructions.
- 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 Kubernetes Actions under the Library section.
-
Search for Execute Kubernetes Manifest and drag it into your workflow.
-
Select the Kubernetes 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:
-
Manual Entry: You can manually enter
kubernetes_manifest
YAML. -
AI Assistance: Alternatively, use AI to generate the manifest YAML based on your inputs.
-
Provide Command: Specify the desired
kubectl
command to run, such asapply
,create
,delete
, orreplace
. 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
Parameter | Required | Description |
---|---|---|
kubectl_command | Yes | Specifies the kubectl command to execute on the manifest. Supports commands like apply , create , delete , and replace . JSON output is added if supported. |
kubernetes_manifest | Yes | The YAML manifest file content defining Kubernetes resources to manage. |
kubeconfig_path | No | Path to the Kubernetes configuration file on the agent, if different from the default ~/.kube/config . |
run_as_user | Yes | The user under which the command will execute (default is ubuntu ). |
execution_timeout | Yes | Maximum 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