# Kubernetes Mastery

> Advanced K8s Operators and Helm Charts development.

- Skill: `j4flmao/kubernetes-mastery` (Agent Skill)
- Install (CLI): `npx skillmds@latest add j4flmao/kubernetes-mastery`
- Raw SKILL.md: https://api.skillmd.com/api/skills/j4flmao/kubernetes-mastery/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: j4flmao (https://skillmd.com/u/j4flmao)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/j4flmao/kubernetes-mastery

---


# Kubernetes Mastery

Focus on writing robust Kubernetes Operators and advanced Helm Charts.

## K8s Operator Snippet (Go)
```go
import (
    "context"
    "github.com/go-logr/logr"
    ctrl "sigs.k8s.io/controller-runtime"
    "sigs.k8s.io/controller-runtime/pkg/client"
)

type MyReconciler struct {
    client.Client
    Log logr.Logger
}

func (r *MyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
    _ = r.Log.WithValues("myresource", req.NamespacedName)
    // Reconcile logic here
    return ctrl.Result{}, nil
}
```

## Advanced Helm Chart (YAML)
```yaml
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "mychart.fullname" . }}
  annotations:
    {{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
  rules:
    {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
          {{- range .paths }}
          - path: {{ .path }}
            pathType: {{ .pathType }}
            backend:
              service:
                name: {{ include "mychart.fullname" $ }}
                port:
                  number: {{ $.Values.service.port }}
          {{- end }}
    {{- end }}
{{- end }}
```

## Architecture Diagram
```mermaid
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
    A["CRD Created"] --> B{"Operator Watches"}
    B -->|"Event triggered"| C["Reconcile Loop"]
    C --> D["Update Status"]
    C --> E["Create/Update Resources"]
```

