Getting Started
Introduction & Resources on Operators
Operators manage both cluster and non-cluster resources on behalf of Kubernetes. This Java Operator SDK (JOSDK) aims at making it as easy as possible to write Kubernetes operators in Java using an API that should feel natural to Java developers and without having to worry about many low-level details that the SDK handles automatically.
For an introduction on operators, please see this blog post. or this talk
You can read about the common problems JOSDK is solving for you here.
You can also refer to the Writing Kubernetes operators using JOSDK blog series .
Generating Project Skeleton
Project includes a maven plugin to generate a skeleton project:
mvn io.javaoperatorsdk:bootstrapper:[version]:create -DprojectGroupId=org.acme -DprojectArtifactId=getting-started
Getting Started
The easiest way to get started with SDK is to start minikube and execute one of our examples. There is a dedicated page to describe how to use the 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/README.md
.
- Setup
kubectl
to work with your Kubernetes cluster of choice. - Apply Custom Resource Definition
- Compile the whole project (framework + samples) using
mvn install
in the root directory - 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 establish a connection to the cluster. This is why it was important to set upkubectl
up front. - You can work in this local development mode to play with the code.
- Build the Docker image and push it to the registry
- Apply RBAC configuration
- Apply deployment configuration
- 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.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.