The Kubernetes API is a sample Kubernetes operator API using the Java Kubernetes Client.
The API is designed for master-worker deployment to satisfy the requirements.
-
The CI/CD tool we used before this API started to not be enough.
The reasons why it is not enough are:- Deployments take too long to create, scale, and terminate.
- In synchronous requests, some of the scenarios' statuses were pending or failed.
- The pending scenarios could not be retried.
- Rollbacks could not be performed automatically.
- Since there was a strict structure to the deployment process, we could not do the business development at any stage.
By using this API, above problems have been solved. You can use this API for such requirements.
-
In the resources folder of our application we have:
master-deployment.yaml, worker-deployment.yaml, master-service.yaml, master-service-ui.yaml
You must customize these files to suit you. This pattern __ was used in file reading operations. Let's not overlook it.
Note that you must use all four of these deployment yaml's. -
The strategy pattern has been used so that the project can work with more than one data center.
You must define the data center strategy you want to use. After that, it will be enough to send it in the data_center field.
The following are the flows that we have implemented in this project.
- Deploy master
- Roll out status
- Deploy worker
- Roll out status
- Create service
- Create service ui
- Print pod status
- Retrieve service list
- Print service status
- Scale deployment
- Roll out status
- Delete master deployment
- Delete worker deployment
- Delete master service
- Delete master ui service
- Java 11
- Spring Boot
- Kubernetes Client
For building and running the application, you need:
mvn clean install
mvn --projects kubernetes-operator-api spring-boot:run
http://localhost:1234
Distributed under the MIT License. See LICENSE for more information.