⚙️ Automated Kubernetes testing with Robot Framework, ArgoCD & with KinD lifecycle

298 views · ⚙️ DevOps & CI/CD

Description

Overview

This n8n workflow provides automated CI/CD testing for Kubernetes applications using KinD (Kubernetes in Docker). It creates temporary infrastructure, runs tests, and cleans up everything automatically.


Three-Phase Lifecycle

INIT Phase - Infrastructure Setup

TEST Phase - Automated Testing

DESTROY Phase - Complete Cleanup


Execution Modes

Full Pipeline Mode (progress_only = false) > Automatically progresses through all phases: INIT → TEST → DESTROY

Single Phase Mode (progress_only = true) > Executes only the specified phase and stops


Prerequisites

Local Environment (n8n Host)

Remote Target Host

External Services


Setup Instructions

Step 1: Install Community Node

  1. In n8n web interface, navigate to SettingsCommunity Nodes
  2. Install n8n-nodes-robotframework
  3. Restart n8n if prompted

Step 2: Configure GitLab OAuth2

Create GitLab OAuth2 Application

  1. Log in to GitLab
  2. Navigate to User SettingsApplications
  3. Create new application with redirect URI: https://your-n8n-instance.com/rest/oauth2-credential/callback
  4. Grant scopes: read_api, read_repository, read_user
  5. Copy Application ID and Secret

Configure in n8n

  1. Create new GitLab OAuth2 API credential
  2. Enter GitLab server URL, Client ID, and Secret
  3. Connect and authorize

Step 3: Prepare GitLab Repository

Create repository structure:

your-repo/
├── test.robot
├── config.yaml
├── demo-applicationSet.yaml
└── .gitlab-ci.yml

Upload your:

Step 4: Configure Telegram Bot

Create Bot

  1. Open Telegram, search for @BotFather
  2. Send /newbot command
  3. Save the API token

Get Chat ID

For personal chat:

For group chat:

Configure in n8n

  1. Create Telegram API credential
  2. Enter bot token
  3. Save credential

Step 5: Prepare Target Host

Verify SSH access:

The workflow will automatically install dependencies.

Step 6: Import and Configure Workflow

Import Workflow

  1. Copy workflow JSON
  2. In n8n, click WorkflowsImport from File/URL
  3. Import the JSON

Configure Parameters

Open Set Parameters node and update:

ParameterDescriptionExample
target_hostIP address of remote host192.168.1.100
target_portSSH port22
target_userSSH usernameubuntu
target_passwordSSH passwordyour_password
progressStarting phaseINIT, TEST, or DESTROY
progress_onlyExecution modetrue or false
KIND_CONFIGPath to config.yamlconfig.yaml
ROBOT_SCRIPTPath to test.robottest.robot
ARGOCD_APPSETPath to ApplicationSetdemo-applicationSet.yaml

> Security: Use n8n credentials or environment variables instead of storing passwords in the workflow.

Configure GitLab Nodes

For each of the three GitLab nodes:

Configure Telegram Nodes

  1. Send ROBOT Script Export Pack node:

    • Set Chat ID
    • Select Credentials
  2. Process Finish Report node:

    • Update chat ID in command

Step 7: Test and Execute

  1. Test individual components first
  2. Run full workflow
  3. Monitor execution (30-60 minutes total)

How to Use

Execution Examples

Complete Testing Pipeline

Setup Infrastructure Only

Test Existing Infrastructure

Cleanup Only

Trigger Methods

1. Manual Execution

2. Scheduled Execution

3. Webhook Trigger

Monitoring Execution

In n8n Interface:

Via Telegram:

Execution Timeline:

PhaseDuration
INIT15-25 minutes
TEST5-10 minutes
DESTROY5-10 minutes

Understanding Test Results

After TEST phase, receive testing-export-pack.tar.gz via Telegram containing:

To view:

  1. Download .tar.gz from Telegram
  2. Extract: tar -xzf testing-export-pack.tar.gz
  3. Open report.html for summary
  4. Open log.html for detailed steps

Success indicators:

Failure indicators:


Configuration Files

test.robot

Robot Framework test script structure:

config.yaml

KinD cluster configuration:

demo-applicationSet.yaml

ArgoCD Application manifest:

gitlab-ci.yml

Triggers n8n workflow on commits:


Troubleshooting

SSH Permission Denied

Symptoms:

Error: Permission denied (publickey,password)

Solutions:

Docker Installation Fails

Symptoms:

Error: Package docker-ce is not available

Solutions:

KinD Cluster Creation Timeout

Symptoms:

Error: Failed to create cluster: timed out

Solutions:

ArgoCD Not Accessible

Symptoms:

Error: Failed to connect to autotest.innersite

Solutions:

Robot Framework Tests Fail

Symptoms:

Error: Chrome failed to start

Solutions:

Telegram Notification Not Received

Symptoms:

Solutions:

Workflow Hangs

Symptoms:

Solutions:


Best Practices

Development Workflow

  1. Test locally first

    • Run Robot Framework tests on local machine
    • Verify test script syntax
  2. Version control

    • Keep all files in Git
    • Use branches for experiments
    • Tag stable versions
  3. Incremental changes

    • Make small testable changes
    • Test each change separately
  4. Backup data

    • Export workflow regularly
    • Save test results
    • Store credentials securely

Production Deployment

  1. Separate environments

    • Dev: Frequent testing
    • Staging: Pre-production validation
    • Production: Stable scheduled runs
  2. Monitoring

    • Set up execution alerts
    • Monitor host resources
    • Track success/failure rates
  3. Disaster recovery

    • Document cleanup procedures
    • Keep backup host ready
    • Test restoration process
  4. Security

    • Use SSH keys
    • Rotate credentials quarterly
    • Implement network segmentation

Maintenance Schedule

FrequencyTasks
DailyReview logs, check notifications
WeeklyReview failures, check disk space
MonthlyUpdate dependencies, test recovery
QuarterlyRotate credentials, security audit

Advanced Topics

Custom Configurations

Multi-node clusters:

Advanced testing:

Integration with Other Tools

Monitoring:

Logging:

CI/CD Integration:


Resource Requirements

Minimum

ComponentCPURAMDisk
n8n Host24 GB20 GB
Target Host48 GB20 GB
ComponentCPURAMDisk
n8n Host48 GB50 GB
Target Host816 GB50 GB

Useful Commands

KinD

Docker

Kubernetes

Robot Framework


Additional Resources

Official Documentation

Community

🔗 Nodes Used

Webhook, Telegram, GitLab, Schedule Trigger, Read/Write Files from Disk

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup