Back to Skills

go-kubernetes

verified

Kubernetes operators and client-go development

View on GitHub

Marketplace

pluginagentmarketplace-go

pluginagentmarketplace/custom-plugin-go

Plugin

go-development-assistant

Repository

pluginagentmarketplace/custom-plugin-go
3stars

skills/go-kubernetes/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-go/blob/main/skills/go-kubernetes/SKILL.md -a claude-code --skill go-kubernetes

Installation paths:

Claude
.claude/skills/go-kubernetes/
Powered by add-skill CLI

Instructions

# Go Kubernetes Skill

Build Kubernetes operators and controllers with client-go.

## Overview

Develop custom Kubernetes controllers, operators, and CRDs using client-go and controller-runtime.

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| type | string | yes | - | Type: "operator", "controller", "crd" |
| framework | string | no | "controller-runtime" | Framework |

## Core Topics

### Client Setup
```go
import (
    "k8s.io/client-go/kubernetes"
    "k8s.io/client-go/rest"
    "k8s.io/client-go/tools/clientcmd"
)

func NewClient() (*kubernetes.Clientset, error) {
    config, err := rest.InClusterConfig()
    if err != nil {
        // Fallback to kubeconfig
        kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
        config, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
        if err != nil {
            return nil, err
        }
    }

    return kubernetes.NewForConfig(config)
}
```

### Watch Resources
```go
func WatchPods(ctx context.Context, client *kubernetes.Clientset, namespace string) error {
    watcher, err := client.CoreV1().Pods(namespace).Watch(ctx, metav1.ListOptions{})
    if err != nil {
        return err
    }
    defer watcher.Stop()

    for event := range watcher.ResultChan() {
        pod := event.Object.(*corev1.Pod)
        switch event.Type {
        case watch.Added:
            fmt.Printf("Pod added: %s\n", pod.Name)
        case watch.Modified:
            fmt.Printf("Pod modified: %s (phase: %s)\n", pod.Name, pod.Status.Phase)
        case watch.Deleted:
            fmt.Printf("Pod deleted: %s\n", pod.Name)
        }
    }
    return nil
}
```

### Controller-Runtime Reconciler
```go
type MyReconciler struct {
    client.Client
    Scheme *runtime.Scheme
    Log    logr.Logger
}

func (r *MyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
    log := r.Log.WithValues("resource", req.Namesp

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
2972 chars