Java Operator SDK - Documentation #

Introduction & Resources on Operators #

Operators are easy and simple way to manage resource on Kubernetes clusters but also outside the cluster. The goal of this SDK is to allow writing operators in Java by providing a nice API and handling common issues regarding the operators on framework level.

For an introduction, what is an operator see this blog post.

You can read about the common problems what is this operator framework is solving for you here.

Getting Started #

The easiest way to get started with SDK is start minikube and execute one of our examples. There is a dedicated page to describe how to use samples.

Here are the main steps to develop the code and deploy the operator to a Kubernetes cluster. A more detailed and specific version can be found under samples/mysql-schema/

  1. Setup kubectl to work with your Kubernetes cluster of choice.
  2. Apply Custom Resource Definition
  3. Compile the whole project (framework + samples) using mvn install in the root directory
  4. Run the main class of the sample you picked and check out the sample’s README to see what it does. When run locally the framework will use your Kubernetes client configuration (in ~/.kube/config) to make the connection to the cluster. This is why it was important to set up kubectl up front.
  5. You can work in this local development mode to play with the code.
  6. Build the Docker image and push it to the registry
  7. Apply RBAC configuration
  8. Apply deployment configuration
  9. Verify if the operator is up and running. Don’t run it locally anymore to avoid conflicts in processing events from the cluster’s API server.