> For the complete documentation index, see [llms.txt](https://docs.rated.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rated.co/onboarding-your-data/self-hosting/running-with-kubernetes-k8s.md).

# Running with Kubernetes (k8s)

This guide explains how to deploy and run the Rated Log Indexer in a Kubernetes environment.

### Prerequisites

* Access to a Kubernetes cluster
* `kubectl` CLI tool installed and configured
* Basic understanding of Kubernetes concepts (ConfigMaps, Deployments)
* Rated Log Indexer credentials and configuration details

### Setup Instructions

#### 1. Prepare Configuration

1. Navigate to the `config` directory where you'll find `rated-configmap.example.yaml`
2. Create your configuration file:

```bash
cp config/rated-configmap.example.yaml config/rated-configmap.yaml
```

3. Modify the configuration file with your specific settings

The example file includes both the ConfigMap for your indexer configuration and the Deployment specification needed for Kubernetes.

#### 2. Deploy to Kubernetes

Apply the configurations to your cluster:

```bash
kubectl apply -f config/rated-configmap.yaml
```

#### 3. Verify Deployment

Check the status of your deployment:

```bash
# Check deployment status
kubectl get deployments rated-log-indexer

# Check pod status
kubectl get pods -l app=rated-log-indexer

# View logs
kubectl logs -l app=rated-log-indexer
```

### Configuration Reference

#### ConfigMap Settings

The ConfigMap contains your Rated Log Indexer configuration in YAML format. Key sections include:

* `inputs`: Configure your data sources
  * `integration`: Specify the integration type (e.g., cloudwatch)
  * `filters`: Define how to process and transform logs
  * `offset`: Configure ingestion tracking and start points
* `output`: Configure where processed data should be sent
* `secrets`: Manage sensitive information

{% content-ref url="/pages/tliP1y9xUtQaJQBYMo72" %}
[Configuration yaml](/onboarding-your-data/self-hosting/configuration-yaml.md)
{% endcontent-ref %}

#### Deployment Settings

The Deployment configuration defines how the indexer runs in your cluster:

* `replicas`: Number of indexer instances (default: 1)
* `image`: Docker image to use (default: `ratedlabs/rated-log-indexer:latest`)
* `volumeMounts`: Configuration file mounting
* `volumes`: ConfigMap volume definition

{% embed url="<https://hub.docker.com/r/ratedlabs/rated-log-indexer/tags>" %}

### Security Considerations

1. **Sensitive Data**: Consider using Kubernetes Secrets instead of ConfigMap for sensitive values
2. **RBAC**: Ensure appropriate RBAC policies are in place for the indexer pod

### Troubleshooting

#### Common Issues

1. **Pod Startup Failures**

```bash
kubectl describe pod -l app=rated-log-indexer
```

2. **Configuration Issues**

```bash
# View ConfigMap
kubectl get configmap indexer-config -o yaml

# Check container logs
kubectl logs -l app=rated-log-indexer
```

3. **Resource Constraints**

```bash
kubectl top pod -l app=rated-log-indexer
```

### Maintenance

#### Updating Configuration

1. Update the ConfigMap:

```bash
kubectl apply -f config/rated-configmap.yaml
```

2. Restart the pods:

```bash
kubectl rollout restart deployment rated-log-indexer
```

#### Version Updates

To update the indexer version:

```bash
kubectl set image deployment/rated-log-indexer indexer=ratedlabs/rated-log-indexer:new-version
```

### Best Practices

1. Always use version tags for the Docker image instead of `latest`
2. Implement appropriate resource requests and limits
3. Set up monitoring and alerting
4. Regularly backup your configuration
5. Use namespaces to isolate the indexer deployment
6. Implement liveness and readiness probes
