Build Status Maven Central License

Skuber

Skuber is a Scala client library for Kubernetes. It provides a fully featured, high-level and strongly typed Scala API for managing Kubernetes cluster resources (such as Pods, Services, Deployments, ReplicaSets, Ingresses etc.) via the Kubernetes REST API server.

Features

See the programming guide for more details.

Example

This example lists pods in kube-system namespace:

  import skuber._
  import skuber.json.format._
  import akka.actor.ActorSystem
  import akka.stream.ActorMaterializer
  import scala.util.{Success, Failure}

  implicit val system = ActorSystem()
  implicit val materializer = ActorMaterializer()
  implicit val dispatcher = system.dispatcher

  val k8s = k8sInit
  val listPodsRequest = k8s.listInNamespace[PodList]("kube-system")
  listPodsRequest.onComplete {
    case Success(pods) => pods.items.foreach { p => println(p.name) }
    case Failure(e) => throw(e)
  }

See more elaborate example here.

Quick Start

Make sure prerequisites are met. There are couple of quick ways to get started with Skuber:

With Ammonite-REPL

Provides you with a configured client on startup. It is handy to use this for quick experiments.

Interactive with sbt

For other Kubernetes setups, see the configuration guide for details on how to tailor the configuration for your clusters security, namespace and connectivity requirements.

Prerequisites

A Kubernetes cluster is needed at runtime. For local development purposes, minikube is recommended. To get minikube follow the instructions here

Release

You can use the latest release (for Scala 2.11, 2.12 or 2.13) by adding to your build:

libraryDependencies += "io.skuber" %% "skuber" % "2.4.0"

Meanwhile users of skuber v1 can continue to use the final v1.x release, which is available only on Scala 2.11:

libraryDependencies += "io.skuber" % "skuber_2.11" % "1.7.1"

NOTE: Skuber 2 supports Scala 2.13 since v2.4.0 - support for Scala 2.11 is now deprecated and will be removed in a future release.

Migrating to release v2

If you have an application using the legacy version v1 of Skuber and want to move to v2, then check out the migration guide.

Building

Building the library from source is very straightforward. Simply run sbt testin the root directory of the project to build the library (and examples) and run the unit tests to verify the build.

License

This code is licensed under the Apache V2.0 license, a copy of which is included here.