Kubiya LogoKubiya Developer Docs

CLI Examples

Practical examples of using the Kubiya CLI for various workflows.

CLI Examples

This page provides practical examples of using the Kubiya CLI for common workflows.

Quick Reference Examples

# Install CLI (macOS)
brew tap kubiyabot/kubiya && brew install kubiya
 
# Verify installation
kubiya --version
 
# Set up authentication
kubiya auth login
 
# Configure defaults
kubiya config set output-format json
kubiya config set default-teammate "devops-expert"

Common Workflows

DevOps Automation

# Deploy a service to production
kubiya tools execute deploy-service \
  --args '{"service":"api","env":"production","version":"1.2.0"}' \
  --output json
 
# Generate infrastructure as code
kubiya chat "Generate Terraform code for an AWS S3 bucket with versioning enabled" \
  --teammate "iac-expert" \
  --output-file "s3_bucket.tf"
 
# Check system health
kubiya tools execute check-system-health --args '{"systems":["api","database","cache"]}'

Development Assistance

# Review code for a pull request
kubiya tools execute code-review \
  --args '{"repo":"org/repo","pr_number":123}' \
  --output-file "review.md"
 
# Generate unit tests
kubiya chat "Generate unit tests for this function" \
  --files "src/utils.js" \
  --output-file "src/utils.test.js"
 
# Get code recommendations
kubiya chat "How can I optimize this database query?" \
  --files "query.sql" \
  --teammate "database-expert"

Knowledge Management

Create knowledge base entries

# Add a document to the knowledge base
kubiya knowledge create \
  --title "AWS Best Practices" \
  --content "./docs/aws-best-practices.md" \
  --tags "aws,cloud,best-practices"
 
# Add a website reference
kubiya knowledge create-from-url \
  --title "Kubernetes Documentation" \
  --url "https://kubernetes.io/docs/home/" \
  --tags "kubernetes,k8s"

Browse and search knowledge

# List all knowledge items
kubiya knowledge list
 
# Search for specific topics
kubiya knowledge search "kubernetes scaling"

Advanced Usage

Working with Teammates

# Create a custom teammate
kubiya teammates create \
  --name "compliance-expert" \
  --description "Handles compliance questions and audit tasks" \
  --knowledge-sources "compliance-docs,regulatory-guides" \
  --file teammate-config.yaml
 
# Update teammate capabilities
kubiya teammates update "deployment-assistant" \
  --tools "deploy-service,rollback-service,service-status"

Automation & Scheduling

# Schedule a recurring task
kubiya tools execute create-schedule \
  --args '{"name":"daily-backup","command":"backup-db","schedule":"0 2 * * *"}'
 
# Create workflow automation
kubiya tools execute workflow-run \
  --args '{"workflow":"release-process","version":"1.0.0"}'

Integration with CI/CD

# GitLab CI example (.gitlab-ci.yml)
deploy:
  script:
    - kubiya tools execute deploy-service 
      --args '{"service":"api","env":"staging","version":"$CI_COMMIT_TAG"}'
  environment:
    name: staging
  variables:
    KUBIYA_API_KEY: $KUBIYA_API_KEY
 
# GitHub Actions example
- name: Deploy to Production
  run: |
    kubiya tools execute deploy-service \
      --args '{"service":"api","env":"production","version":"${{ github.ref_name }}"}'
  env:
    KUBIYA_API_KEY: ${{ secrets.KUBIYA_API_KEY }}

Use kubiya --help or append --help to any command to see all available options.

On this page