You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Streamline the MultiKueue ClusterProfile API documentation (#8390)
* Streamline the MultiKueue ClusterProfile API documentation
* Add plugin example links to MultiKueue ClusterProfile docs
* Add image volumes as an option for mounting plugins
@@ -34,7 +34,6 @@ To create the sample queue setup in the `default` namespace, you can apply the f
34
34
35
35
### MultiKueue Specific Kubeconfig
36
36
37
-
38
37
In order to delegate the jobs in a worker cluster, the manager cluster needs to be able to create, delete, and watch workloads and their parent Jobs.
39
38
40
39
While `kubectl` is set up to use the worker cluster, download:
@@ -131,27 +130,79 @@ It provides a robust, modular, and extensible framework that helps other open so
131
130
The integration with OCM is an optional solution that enables Kueue users to streamline the MultiKueue setup process, automate the generation of MultiKueue specific Kubeconfig, and enhance multicluster scheduling capabilities.
132
131
For more details about this solution, please refer to this [link](https://github.com/open-cluster-management-io/ocm/tree/main/solutions/kueue-admission-check).
133
132
134
-
## Setup MultiKueue with ClusterProfile API
133
+
## Configure federated credential discovery via the ClusterProfile API
The [ClusterProfile API](https://multicluster.sigs.k8s.io/concepts/cluster-profile-api/) provides a standardized, vendor-neutral interface for presenting cluster information. It allows defining cluster access information in a standardized `ClusterProfile` object and using credential plugins for authentication.
137
+
The [Cluster Inventory API](https://multicluster.sigs.k8s.io/) provides a standardized, vendor-neutral interface for representing a cluster's properties and status.
138
+
It defines a `ClusterProfile` resource that encapsulates the identity, metadata, and status of a specific cluster within a multi-cluster environment.
139
+
140
+
Kueue can leverage the configuration contained within a `ClusterProfile` object to obtain credentials and connect to the cluster it represents.
141
+
In practice, this means that instead of using Kubeconfig files to specify the connection to its workers, the manager cluster uses the state and
142
+
access providers contained in the existing `ClusterProfile`s. This eliminates a large portion of management required from the administrator and
143
+
allows to delegate credentialing to the entity managing the clusters (like a cloud provider).
144
+
145
+
{{% alert title="Note" color="primary" %}}
146
+
147
+
Kueue itself does not manage the `ClusterProfile` resources, which is the responsibility of the cluster manager, for example a cloud provider or a dedicated controller.
148
+
149
+
{{% /alert %}}
150
+
151
+
### Enable the `MultiKueueClusterProfile` feature gate
152
+
153
+
The `MultiKueueClusterProfile` feature gate has to be enabled for Kueue to consider `ClusterProfile` objects when connecting to clusters.
154
+
Refer to the [Installation guide](/docs/installation/#change-the-feature-gates-configuration) for instructions on configuring feature gates.
155
+
156
+
### Provision the `ClusterProfile` objects for your clusters
157
+
158
+
#### Cloud provider managed cluster inventory
159
+
160
+
When using a cloud provider that supports the automatic generation and synchronization of a cluster inventory, the `ClusterProfile` objects are
161
+
managed directly by their platform and do not require that the user sets them up manually or uses a dedicated controller.
162
+
163
+
To enable the generation of an inventory, refer to your cloud provider's documentation:
164
+
* Google Cloud Platform:
165
+
*[Full walkthrough of MultiKueue setup with ClusterProfile](https://github.com/GoogleCloudPlatform/gke-fleet-management/blob/b9fe08386c48f84617cb8ab7b042f2790741e893/multikueue-clusterprofile/README.md).
* `cloud-provider-service-name` is the name of the service within the cloud provider that manages the cluster. For example `gke-fleet`.
193
+
* `cluster-url` is the URL of the cluster's control plane.
194
+
* `access-provider-name` is the name of the provider of the cluster's credentials. For example `google`.
144
195
145
-
###Create ClusterProfile objects
196
+
#### Manually created cluster inventory
146
197
147
-
If you are using a cloud provider, refer to the documentation on how to generate ClusterProfile objects (e.g. [GKE](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/generate-inventory-for-integrations)). Alternatively, you can manually install the `ClusterProfile` CRD and objects for your clusters.
198
+
In principle, the `ClusterProfile` objects can be provisioned without the use of a cloud provider.
148
199
149
-
To install the `ClusterProfile`CRD, run:
200
+
Firstly, the `ClusterProfile` CRDs have to be manually installed within the cluster:
Next, configure the controller manager config map with the credentials providers.
223
+
The `ClusterProfile` access providers are within the object's `status` subresource and, in principle, should be managed by the cluster manager
224
+
(i.e. the entity provisioning the clusters, like a cloud provider) and not created manually.
174
225
175
-
```yaml
176
-
apiVersion: v1
177
-
data:
178
-
controller_manager_config.yaml: |
179
-
...
180
-
multiKueue:
181
-
clusterProfile:
182
-
credentialsProviders:
183
-
- name: ${PROVIDER_NAME}
184
-
execConfig:
185
-
apiVersion: client.authentication.k8s.io/v1beta1
186
-
command: /plugins/${PLUGIN_COMMAND}
187
-
kind: ConfigMap
188
-
metadata:
189
-
labels:
190
-
app.kubernetes.io/name: kueue
191
-
control-plane: controller-manager
192
-
name: kueue-manager-config
193
-
namespace: kueue-system
194
-
```
226
+
{{% /alert %}}
227
+
228
+
### Install the access provider plugin
195
229
196
-
### Install Required Plugins
230
+
The access provider defined in `ClusterProfile` depends upon an executable plugin being available to the
231
+
Kueue controller manager pods running within the MultiKueue manager cluster.
232
+
It's the responsibility of the Kueue administrator to make sure that the required command is available.
197
233
198
-
If your credentials provider requires an executable plugin, you must make it available to the Kueue manager.
234
+
An example plugin can be found [here](https://github.com/kubernetes-sigs/cluster-inventory-api/tree/445319b6307a88778b930e154ed3e2f38d85a689/cmd/secretreader-plugin) (secret reader) or [here](https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke) (Google Cloud Platform).
199
235
200
-
#### Add plugins via volume mounts
236
+
#### Mount the executable with `initContainers`
201
237
202
-
You can use an `initContainer` to add the plugin to a shared `emptyDir` volume before the Kueue manager starts. The `kueue-controller-manager` container can then mount this volume to access the plugin.
238
+
The [`initContainers`](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) field within the pods specification
239
+
can be used to populate a volume with the required plugin. The image used by the init container has to be built beforehand.
203
240
204
-
Here is an example patch for the `kueue-controller-manager` deployment that adds a custom authentication plugin:
241
+
The `kueue-controller-manager` container within the Kueue manager deployment can then mount this volume in its filesystem to access the executable.
1. Adds an `initContainer` that copies the `${PLUGIN_COMMAND}` from its container image to the `/plugins` directory in the shared volume.
234
-
2. Adds an `emptyDir` volume named `clusterprofile-plugins` to the pod.
235
-
3. Mounts the `clusterprofile-plugins` volume to the `manager` container, making the plugin available at `/plugins/${PLUGIN_COMMAND}`.
270
+
Where:
271
+
* `plugin-image` is the image reference of an image that contains the plugin executable.
272
+
* `plugin-command` is the name of the executable. For example `gcp-auth-plugin`.
273
+
274
+
#### (Kubernetes 1.35+) Mount the executable using an image volume
275
+
276
+
The ability to [mount content from OCI registries into containers](https://kubernetes.io/docs/tasks/configure-pod-container/image-volumes/) reached beta in Kubernetes 1.35. This feature streamlines some aspects of the `initContainers` approach.
277
+
278
+
For example:
279
+
280
+
```yaml
281
+
apiVersion: apps/v1
282
+
kind: Deployment
283
+
metadata:
284
+
name: kueue-controller-manager
285
+
namespace: kueue-system
286
+
spec:
287
+
template:
288
+
spec:
289
+
containers:
290
+
- name: manager
291
+
volumeMounts:
292
+
- name: clusterprofile-plugins
293
+
mountPath: "/plugins"
294
+
volumes:
295
+
- name: clusterprofile-plugins
296
+
image:
297
+
reference: <plugin-image>
298
+
pullPolicy: IfNotPresent
299
+
```
300
+
301
+
Where:
302
+
* `plugin-image` is the image reference of an image that contains the plugin executable.
303
+
304
+
The files inside the `plugin-image` will be accessible under the `mountPath` (in this case `/plugins`)
305
+
and can be called analogously to the `initContainers` approach (`/plugins/<plugin-command>`).
306
+
307
+
#### Build a custom Kueue manager image
308
+
309
+
Alternatively, a custom Kueue manager image can be built to include the plugin executable.
310
+
The image reference in the Kueue manager deployment should then point to the user-managed custom image.
311
+
312
+
### Define the credentials provider in the Kueue manager config
313
+
314
+
To connect the access providers specified in the `ClusterProfile`s with the mounted plugin,
315
+
an entry within the Kueue configuration has to be created:
316
+
317
+
```yaml
318
+
apiVersion: v1
319
+
data:
320
+
controller_manager_config.yaml: |
321
+
...
322
+
multiKueue:
323
+
clusterProfile:
324
+
credentialsProviders:
325
+
- name: <access-provider-name>
326
+
execConfig:
327
+
apiVersion: client.authentication.k8s.io/v1beta1
328
+
command: /plugins/<plugin-command>
329
+
kind: ConfigMap
330
+
metadata:
331
+
labels:
332
+
app.kubernetes.io/name: kueue
333
+
control-plane: controller-manager
334
+
name: kueue-manager-config
335
+
namespace: kueue-system
336
+
```
236
337
237
-
#### Build a custom image
338
+
Where:
339
+
* `access-provider-name` is the name of the provider of the cluster's credentials.
340
+
It has to match the `accessProviders` name in the relevant `ClusterProfile`s.
341
+
* `plugin-command` is the name of the executable within the manager container.
238
342
239
-
Alternatively, you can build a custom Kueue manager image that includes your plugin. You would then update your Kueue deployment to use this new image.
343
+
This definition will configure the `ClusterProfile`s using the `access-provider-name` to retrieve
344
+
cluster credentials via the `plugin-command` executable.
240
345
241
-
### Configure MultiKueueCluster objects
346
+
### Link `MultiKueueCluster` objects to their corresponding `ClusterProfile`
242
347
243
-
When using the `ClusterProfile` API for authentication, configure your `MultiKueueCluster` objects to reference a `ClusterProfile` via the `clusterProfileRef` field, instead of providing `kubeconfig` directly.
348
+
When using the `ClusterProfile` API for authentication, the `MultiKueueCluster` objects have to reference a `ClusterProfile` via the `clusterProfileRef` field,
349
+
instead of providing `kubeconfig` directly.
244
350
245
351
Here's an example `MultiKueueCluster` object using a `clusterProfileRef`:
0 commit comments