# Kubernetes Module Examples

The Kubernetes module provides utilities for cluster management, configuration, operations, and automation.

## Functions

### Cluster Management
- Create, list, and manage Kubernetes namespaces
- Deploy and manage pods, deployments, and services
- Configure RBAC and cluster settings

### Advanced Features
- **KubeBuilder**: Streamlined Kubernetes cluster provisioning
- **Traefik**: Ingress controller configuration and management
- **Registry**: Container registry integration and management
- **MQTT**: MQTT broker deployment in Kubernetes
- **Error Handling**: Comprehensive error handling with pattern matching

## Examples

### Basic Operations
- `01_namespace_operations.rhai` - Creating and managing namespaces
- `02_pod_management.rhai` - Pod lifecycle management

### Advanced Patterns
- `03_pcre_pattern_matching.rhai` - Pattern matching with PCRE regex
- `04_error_handling.rhai` - Comprehensive error handling patterns
- `05_production_safety.rhai` - Production-ready safety patterns

### Test Suite
- `run_all_tests.rhai` - Complete test suite runner

## Running Examples

```bash
herodo rhaiexamples/virt/kubernetes/01_namespace_operations.rhai
herodo rhaiexamples/virt/kubernetes/02_pod_management.rhai
herodo rhaiexamples/virt/kubernetes/run_all_tests.rhai
```

## Features

The kubernetes module is an optional feature. Enable it with:

```toml
[dependencies]
herolib-virt = { version = "0.2.0", features = ["kubernetes"] }
```

Or use the `full` feature which includes everything:

```toml
[dependencies]
herolib-virt = { version = "0.2.0", features = ["full"] }
```

## Notes

- Kubernetes module requires valid kubeconfig setup
- Most operations require active cluster connection
- Error handling patterns should be used for robustness
- See production safety examples for best practices
