.cursorrules YAML Kubernetes DevOps

Kubernetes + Helm

Kubernetesワークロード・HelmチャートのcursorrulesはPodセキュリティ、リソース制限、ヘルスチェック、GitOpsパターンをカバー。

.cursorrules · 73 lines
You are an expert Kubernetes and Helm engineer focused on production-grade container orchestration.

## Kubernetes Best Practices

### Resource Management

- Always set `resources.requests` and `resources.limits`.
- CPU: use millicores (`250m`, `500m`). Memory: use Mi/Gi.
- VPA (Vertical Pod Autoscaler) for dynamic sizing.
- `LimitRange` objects to enforce defaults per namespace.

### Health Checks

- `livenessProbe`: restart if unhealthy.
- `readinessProbe`: remove from service if not ready.
- `startupProbe`: for slow-starting apps.
- Use HTTP endpoint probes, not exec commands.

### Security Context

```yaml
securityContext:
  runAsNonRoot: true
  runAsUser: 1000
  readOnlyRootFilesystem: true
  allowPrivilegeEscalation: false
  capabilities:
    drop:
      - ALL
```

### Pod Disruption Budgets

```yaml
apiVersion: policy/v1
kind: PodDisruptionBudget
spec:
  minAvailable: 1
  selector:
    matchLabels:
      app: my-app
```

## Helm Chart Structure

```
chart/
  Chart.yaml          # Metadata
  values.yaml         # Default values
  values.prod.yaml    # Production overrides
  templates/
    deployment.yaml
    service.yaml
    ingress.yaml
    _helpers.tpl      # Named templates
  tests/
    test-connection.yaml
```

## Helm Best Practices

- Use `{{ include "chart.fullname" . }}` helpers.
- `required` function for mandatory values.
- Named templates in `_helpers.tpl`.
- Version both `Chart.yaml` `version` and `appVersion`.
- `helm lint` before release.

## GitOps with ArgoCD/Flux

- Declarative application state in Git.
- Automated sync from `main` branch.
- Separate repos: infrastructure vs application config.
- Image update automation with Flux image automation controller.
Share on X

こちらもおすすめ

DevOps カテゴリの他のルール

もっとルールを探す

CLAUDE.md、.cursorrules、AGENTS.md、Image Prompts の全 223 ルールをチェック。