---
title: "Kubernetes Manifests"
description: "Kubernetes manifest files for TraceRTM"
keywords: [kubernetes, k8s, manifests, yaml, deployment]
---

# Kubernetes Manifests

Kubernetes manifest files for deploying TraceRTM.

## Deployment Manifest

### API Deployment

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tracertm-api
  labels:
    app: tracertm-api
spec:
  replicas: 3
  selector:
    matchLabels:
      app: tracertm-api
  template:
    metadata:
      labels:
        app: tracertm-api
    spec:
      containers:
      - name: api
        image: tracertm:2.4.0
        ports:
        - containerPort: 8000
        env:
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: tracertm-secrets
              key: database-url
        - name: SECRET_KEY
          valueFrom:
            secretKeyRef:
              name: tracertm-secrets
              key: secret-key
        resources:
          requests:
            memory: "512Mi"
            cpu: "500m"
          limits:
            memory: "2Gi"
            cpu: "2000m"
        livenessProbe:
          httpGet:
            path: /health
            port: 8000
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /health
            port: 8000
          initialDelaySeconds: 5
          periodSeconds: 5
```

## Service Manifest

### API Service

```yaml
apiVersion: v1
kind: Service
metadata:
  name: tracertm-api
spec:
  selector:
    app: tracertm-api
  ports:
  - port: 80
    targetPort: 8000
  type: LoadBalancer
```

## ConfigMap

### Configuration

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: tracertm-config
data:
  api-url: "https://api.tracertm.dev"
  log-level: "INFO"
  cache-ttl: "3600"
```

## Secret

### Secrets

```yaml
apiVersion: v1
kind: Secret
metadata:
  name: tracertm-secrets
type: Opaque
stringData:
  database-url: "postgresql://user:pass@db:5432/tracertm"
  secret-key: "your-secret-key"
  redis-url: "redis://redis:6379"
```

## Ingress

### Ingress Configuration

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tracertm-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  tls:
  - hosts:
    - api.tracertm.dev
    secretName: tracertm-tls
  rules:
  - host: api.tracertm.dev
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: tracertm-api
            port:
              number: 80
```

## HorizontalPodAutoscaler

### Auto-Scaling

```yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: tracertm-api-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: tracertm-api
  minReplicas: 3
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 80
```

## Deployment Commands

### Apply Manifests

```bash
# Apply all manifests
kubectl apply -f k8s/

# Apply specific manifest
kubectl apply -f k8s/deployment.yaml

# Check status
kubectl get deployments
kubectl get pods
kubectl get services
```

## Related Documentation

- [Kubernetes Deployment](./02-kubernetes) - K8s deployment guide
- [Helm Charts](./02b-helm-charts) - Helm deployment
