|
1 | 1 | # Passing additional configuration objects |
2 | 2 |
|
3 | | -kOps has initial support for passing additional objects to the cluster, and recognizes a few "well known" objects. |
| 3 | +kOps supports passing additional objects to the cluster, and recognizes certain "well known" objects. |
4 | 4 |
|
5 | | -This support is currently gated behind the `ClusterAddons` feature-flag (i.e. `export KOPS_FEATURE_FLAGS=ClusterAddons`) |
| 5 | +Objects that are not well-known will be applied directly to the cluster's k8s api. |
6 | 6 |
|
7 | | -Objects that are not well-known will be applied to the cluster. Well-known objects will have special handling. |
| 7 | +## Adding objects to a cluster |
| 8 | + |
| 9 | +To add an additional object to an existing cluster, use `kops create -f`: |
| 10 | + |
| 11 | +``` |
| 12 | +kops create -f scheduler-config.yaml |
| 13 | +kops update cluster --name=my.cluster.k8s.local --yes --admin |
| 14 | +kops rolling-update cluster --name=my.cluster.k8s.local --yes |
| 15 | +``` |
| 16 | + |
| 17 | +When creating a new cluster, you can use the `--add` flag (requires the `ClusterAddons` feature flag): |
| 18 | + |
| 19 | +``` |
| 20 | +export KOPS_FEATURE_FLAGS=ClusterAddons |
| 21 | +kops create cluster --name=my.cluster.k8s.local --zones us-east-2a --add scheduler-config.yaml |
| 22 | +kops update cluster --name=my.cluster.k8s.local --yes --admin |
| 23 | +``` |
| 24 | + |
| 25 | +To view the current additional objects for a cluster: |
| 26 | + |
| 27 | +``` |
| 28 | +kops get all -o yaml |
| 29 | +``` |
8 | 30 |
|
9 | 31 | # Well-Known Objects |
10 | 32 |
|
| 33 | +Well-known objects receive special handling from kOps instead of being applied directly to the cluster. |
| 34 | + |
11 | 35 | ## KubeSchedulerConfiguration (group: kubescheduler.config.k8s.io) |
12 | 36 |
|
13 | 37 | KubeSchedulerConfiguration objects allow for custom configuration of |
14 | 38 | kube-scheduler, the component responsible for assigning Pods to Nodes. |
15 | 39 |
|
16 | | -Special handling: the configuration will be written to a file on control plane nodes, |
17 | | -and the kube-scheduler component will be configured to read from that file. |
| 40 | +Fields set in `spec.kubeScheduler` (see [cluster_spec.md](cluster_spec.md#kubescheduler)) are merged on top of the KubeSchedulerConfiguration object. |
| 41 | +This allows you to use KubeSchedulerConfiguration for advanced settings like scheduler profiles and plugins, while using `spec.kubeScheduler` for simpler fields. |
| 42 | + |
| 43 | +Note: the `clientConnection.kubeconfig` field is managed by kOps and must not be set manually. |
18 | 44 |
|
19 | | -Example usage: |
| 45 | +Example KubeSchedulerConfiguration file: |
| 46 | + |
| 47 | +```yaml |
| 48 | +# scheduler-config.yaml |
| 49 | +apiVersion: kubescheduler.config.k8s.io/v1 |
| 50 | +kind: KubeSchedulerConfiguration |
| 51 | +profiles: |
| 52 | + - schedulerName: default-scheduler |
| 53 | + plugins: |
| 54 | + score: |
| 55 | + disabled: |
| 56 | + - name: NodeResourcesBalancedAllocation |
20 | 57 | ``` |
21 | | -export KOPS_FEATURE_FLAGS=ClusterAddons |
22 | | -kops create cluster --name=kubescheduler.k8s.local --zones us-east-2a --add docs/examples/addons/kubescheduler.yaml |
23 | | -kops update cluster --name=kubescheduler.k8s.local --yes --admin |
24 | | -kops validate cluster --name=kubescheduler.k8s.local |
25 | | -``` |
| 58 | +
|
| 59 | +Example usage with an existing cluster: |
| 60 | +
|
| 61 | +``` |
| 62 | +kops create -f scheduler-config.yaml |
| 63 | +kops update cluster --name=my.cluster.k8s.local --yes --admin |
| 64 | +kops rolling-update cluster --name=my.cluster.k8s.local --yes |
| 65 | +``` |
| 66 | + |
| 67 | +# Other Kubernetes Objects |
| 68 | + |
| 69 | +Any Kubernetes object that is not a well-known type (such as ConfigMaps, Deployments, |
| 70 | +DaemonSets, Services, RBAC resources, etc.) will be applied directly to the cluster |
| 71 | +as a standard Kubernetes resource during `kops update cluster`. |
0 commit comments