autobotAI Kubernetes Agent

Overview

The autobotAI Kubernetes Agent is part of the autobotAI suite, offering both code and no-code solutions to interact with Kubernetes clusters and their resources. This agent allows users to perform various actions on cluster resources, such as retrieving information or creating resources, making it ideal for a wide range of automation tasks. Additionally, the Kubernetes Agent supports compliance benchmarks, enabling users to schedule regular compliance checks on the cluster. The results of these checks are accessible in the dashboard insights, providing visibility into compliance status.

Prerequisites

  1. Kubernetes Integration: Ensure you have the necessary integrations set up.
  2. Cluster Access: Ensure that you have access to the Kubernetes cluster where you want to deploy the agent.
  3. Network Access:
    1. Ensure your Kubernetes environment has internet access, specifically over port 443 (HTTPS).
    2. Purpose:
      1. To pull the agent image during setup.
      2. To enable the agent pod to function, as the agent cannot operate without internet connectivity.

Agent Permissions

  1. The agent uses a Kubernetes ClusterRole to interact with the cluster.
  2. By default, this role is configured with read-only permissions across all API groups.
  3. If you plan to perform write operations on cluster resources, ensure to update the manifest file to include the necessary permissions.

How to Install the Agent?

  • Add a New Kubernetes Integration

    1. Log in to autobotAI.
    2. Go to the Kubernetes integration page at Kubernetes Integration.
    3. Add a new Kubernetes integration by providing the integration name and group, then click 'Create.' Add Kubernetes Integration
  • Add an Agent

    1. On the next page, add an agent by providing a name in the designated field. Add Agent
  • Generate Credentials

    1. Click "Next Step" to generate a single kubectl command that contains the necessary Kubernetes secrets. Copy this command and save it securely, as it will be needed in the next steps.
  • Download Agent Deployment File

    1. You can download the agent deployment file by clicking on the Download link.
      1. Local Download: Click the Download link and save the file locally.
      2. Remote Download: Right-click on the Download link, select "Copy link address," and then use the following wget command to download the file on a remote server:
        wget <paste-link-address-here>
      Download Agent Deployment File
  • Deploy the Agent

    1. First, run the command copied from Step 3 to create the required Kubernetes secrets for the agent credentials.
    2. Once the secrets are created, deploy the agent by running the following command to apply the agent deployment file to your cluster:
      kubectl apply -f /path/to/autobotAI-kubernetes-agent.yaml
  • Verify Installation

    1. To verify that the agent has been successfully deployed, run:
      kubectl get pods -w
    2. Confirm that the autobotAI agent pod status is Running.

    Verify Installation 1 Verify Installation 2

  1. After completing these steps, the agent will be added to the Kubernetes integration, and a message confirming successful registration will appear. You can now begin using this integration in your automation workflows, such as the no-code example below to retrieve namespaces information. Agent Usage

Kubernetes Actions

Kubernetes Actions are predefined operations executed via the autobotAI Kubernetes Agent, enabling users to perform various command-line operations on Kubernetes clusters within automation workflows.

Kubernetes Actions are powered by AI, allowing you to leverage AI capabilities to streamline tasks like generating Kubectl CLI commands.

We currently support the following Kubernetes actions:

  1. Execute Kubectl Command

Update Agent

To update the autobotAI Kubernetes agent and ensure it is running the latest version, run the following command:

kubectl rollout restart deployment/autobotai-k8s-agent-deployment

Uninstall/Remove Agent

To uninstall the autobotAI Kubernetes agent and remove all its associated deployment resources, run the following command:

kubectl delete -f /path/to/autobotAI-kubernetes-agent.yaml"

Troubleshooting

1. Check Agent Pod Status

To verify the current status of the autobotAI Kubernetes agent pod, use the following command:

kubectl get pods -l app=autobotai-k8s-agent

2. View Agent Pod Details

To inspect detailed information about the agent pod, including events and configurations, use the following command:

kubectl describe pod -l app=autobotai-k8s-agent

3. Analyze Agent Pod Logs

To view the logs for the autobotAI Kubernetes agent pod, use the following command:

  • Get the Pod Name
    First, list the pods to find the name of the agent pod:

    kubectl get pods -l app=autobotai-k8s-agent
  • View Logs for the Pod
    To view logs for the pod:

    kubectl logs <pod-name>

    Replace <pod-name> with the actual pod name.

    Additional Options:

    1. -f (follow): Stream logs in real-time.

      kubectl logs -f <pod-name>