kubernetes-client
Version, currently main branch1 version
- main branchlatestAug 3, 2026
github.com/cloudnative-cr/crystal-kubernetes-client
Comprehensive Kubernetes client for Crystal with full API coverage.
4 stars
0 dependents
License: Apache-2.0
Installation
# Add this to your shard.yml
dependencies:
kubernetes-client:
github: cloudnative-cr/crystal-kubernetes-client
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.18.2- License
- Apache-2.0
- Author
- Josephine Pfeiffer
- Target
kubernetes-clientfrom src/kubernetes-client.cr
Dependencies
Runtime Dependencies
Development Dependencies
- ameba~> 1.5.0github: crystal-ameba/amebadev
README
Kubernetes Client for Crystal
Type-safe Kubernetes client with full API coverage generated from the OpenAPI spec.
Documentation: https://crystal-kubernetes-client.cloudnative.cr/
Features
- All 718 Kubernetes resource types (generated from swagger.json)
- Server-side apply pattern
- Watch loops with auto-reconnection
- Bearer tokens, client certs, exec providers (OIDC, AWS, GCP, Azure)
- Connection pooling
- Generic CRD client
- Zero-config in-cluster
Installation
dependencies:
kubernetes-client:
github: cloudnative-cr/kubernetes-client
Usage
require "kubernetes-client"
k8s = Kubernetes::Client.new
# List pods
pods = k8s.v1.pods.list_namespaced("default")
pods.items.each { |pod| puts pod.metadata.name }
# Scale deployment
k8s.v1.deployments.scale("default", "nginx", replicas: 10)
# Wait for pod
k8s.v1.pods.wait_until_ready("default", "nginx")
# Get logs
logs = k8s.v1.pods.logs("default", "nginx", tail_lines: 100)
Watch
k8s.watch("/api/v1/namespaces/default/pods") do |event|
puts "#{event.type}: #{event.object.metadata.name}"
end
Custom Resources
struct MyCronTab
include JSON::Serializable
property metadata : Kubernetes::Metadata
property spec : Spec
struct Spec
include JSON::Serializable
property cron_spec : String
property image : String
end
end
crontabs = Kubernetes::Generic(MyCronTab).new(
Kubernetes::Client.new,
api_group: "stable.example.com",
version: "v1",
resource: "crontabs"
)
crontabs.list_namespaced("default").items.each { |ct| puts ct.metadata.name }
crontabs.watch_namespaced("default") { |event| reconcile(event.object) }
Development
git clone https://github.com/cloudnative-cr/kubernetes-client
cd kubernetes-client
shards install
# Generate API bindings
make download-spec
make generate
# Run tests (78 tests, ~146ms)
crystal spec
License
Apache 2.0
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Aug 3, 2026
- Crystal
>= 1.18.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/cloudnative-cr/crystal-kubernetes-client
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1