Kubernetes Client - Alpha Release - kube-client.cr

Hey all! Just wanted to share that I have released an Alpha version of kube-client a Crystal client for interacting with the Kubernetes API.

This initial release supports the kubernetes api versions 1.11-1.23.

Check it out here: GitHub - spoved/kube-client.cr: k8s api client
Report issues here: Issues · spoved/kube-client.cr · GitHub

I hope to continue to develop and improve this client as time goes on. If you are interested please give it a try and report any issues you find.

Thanks!

5 Likes

What you may also want to consider is creating a Podman client/interface.

https://podman.io/

Podman is a container engine that’s compatible with the OCI Containers.

https://opencontainers.org/

More information on it.

https://docs.podman.io/en/latest/index.html

Having Crystal apps for these Open Source standards can make it a player in these spaces.

Yeah i agree, trying to build tooling as i run into them. Podman is an up and comer now that docker sucks.

I had a look at the shard to see what the experience would be like for building operators (my main use case for creating this Kubernetes client) and I couldn’t get it to load my CRD. The README mentions these two methods, which seem to be intended for that:

  • K8S::Resource.from_file
  • K8S::Resource.from_files

But neither of them exist:

require "./src/kube-client/v1.23"

pp K8S::Resource.from_file("./crd.yaml")
# In example.cr:3:18

#  3 | pp K8S::Resource.from_file("./crd.yaml")
#                       ^--------
# Error: undefined method 'from_file' for K8S::Kubernetes::Resource.class

I get the same error for both methods. Am I just not doing it right?

@jgaskins ah. no your not doing it wrong. its a bug. i didnt make from_file a class method. You can just do a from_yaml tho. ill fix that up.

Pushed a quick release. 0.3.1 it really was a issue in the sub-shard that holds all the k8s classes/structs (GitHub - spoved/k8s.cr: A Kubernetes lib containing definitions for Crystal-lang).

3 Likes