1
1
#Kubectl Equivalence in Java
2
2
3
- __ TL;DR__ : Get used to kubectl? Now our kubernetes Java client library has releases a set of
3
+ __ TL;DR__ : Used to kubectl? Now our kubernetes Java client library has released a set of
4
4
helpful client utilities which has the similar input argument interface as the kubectl binary.
5
5
Especially the developers who're already familiar with kubectl commands, after reading this
6
- document, you will know how to program to operate kubernetes as neat as kubectl.
6
+ document, you will know how to build programs that interact with Kubernetes as easily as kubectl.
7
7
8
8
9
9
### What is Java Kubectl
@@ -26,20 +26,22 @@ your project.
26
26
27
27
#### (Optional) Setting a Global Client-Config
28
28
29
- Kubectl static helpers doesn 't know its client-config (or kubeconfig if the name makes more sense to
29
+ Kubectl static helpers don 't know its client-config (or kubeconfig if the name makes more sense to
30
30
you) unless you set it when your application starts. You can either specifies the client-config upon
31
31
invoking kubectl helpers or simply set a global config at the start of your application:
32
32
33
33
``` java
34
34
Configuration . setDefaultApiClient(ClientBuilder . defaultClient());
35
35
```
36
36
37
+ This will create a client on either a client, or a container in Kubernetes.
38
+
37
39
### Manifest of Supported Commands
38
40
39
41
40
42
#### Kubectl get
41
43
42
- You can either query single resource or list multiple resources using the ` Kubectl#get ` helper depending
44
+ You can either query a single resource or list multiple resources using the ` Kubectl#get ` helper depending
43
45
on whether you're passing ` name() ` in the flow. Here is a few illustrative examples for querying pod
44
46
resources:
45
47
@@ -61,7 +63,7 @@ List<V1Pod> pods = Kubectl.get(V1Pod.class)
61
63
#### Kubectl create
62
64
63
65
Currently the ` Kubectl#create ` helper only accepts a desired instance of resource object, you need to do the
64
- deserialization from the source or manually craft an instance of the resource.
66
+ deserialization of a resource object or manually craft an instance of the resource.
65
67
66
68
``` java
67
69
// kubectl create -f <file>
@@ -97,8 +99,8 @@ V1Pod patchedPod = Kubectl.patch(V1Pod.class)
97
99
98
100
#### Kubectl apply
99
101
100
- Note that for now only server-side apply supported, so your apiserver version is required to
101
- be greater than 1.18.0. ` Kubectl#apply ` works the same as ` kubectl apply --server-side=true ` .
102
+ Note that for now only server-side apply is supported, so your apiserver version is required to
103
+ be greater than or equal to 1.18.0. ` Kubectl#apply ` works the same as ` kubectl apply --server-side=true ` .
102
104
103
105
``` java
104
106
// kubectl apply --server-side=true --field-manager=java-kubectl --force-conflict=true -f <file>
0 commit comments