CustomResourceDefinition creation via yaml file in Java Kubernetes api

1/24/2022

I'm working on a big Java project and was wondering 2 things. What would be the more elegant way of implementing the following idea :

I need to initiate a sequence of Kubernetes commands like creating and applying a few YAML files (of CustomResourceDefinition) monitoring them and changing a few things like IP addresses and reading from the spec fields of these CustomResourceDefinition later on.

I was struggling with the Java Kubernetes API when it came to CustomResourceDefinitons in the sense that I didn't see any way to add my relevant spec fields which are not k8s built (like a field that is called copyMethod: Snapshot etc ...)

So my 2 questions are : 1. Is there a better more elegant way of doing this? like some sort of a Job process that could just be initiated via Java 2. Is there something that reads Kubernetes YAML files and creates the resources in these YAML files?

-- Oran Nahoum
java
jobs
kubernetes

0 Answers