apelisse / k8s-client-go

Minimal Go Kubernetes client based on Generics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

Minimal Go Kubernetes client based on Generics

Installing

go get github.com/castai/k8s-client-go

Usage

import (
    "context"
    "log"
    "fmt"
    client "github.com/castai/k8s-client-go"
)

func main() {
    kc, err := client.NewInCluster()
    if err != nil {
        log.Fatal(err)
    }
    ctx := context.Backgroud()
    endpointsOperator := client.NewEndpointsOperator(kc)
    endpoints, err := endpointsOperator.Get(ctx, "kube-system", "kubelet", client.GetOptions{})
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%+v", endpoints)
}

See more in Examples

Use cases

  • Embedding in Go applications for minimal binary size overhead.
  • Service discovery by listing and watching endpoints. See kuberesolver as example for gRPC client side load balancing.

About

Minimal Go Kubernetes client based on Generics

License:Apache License 2.0


Languages

Language:Go 96.8%Language:Shell 2.8%Language:Dockerfile 0.4%