Skip to content

Commit 9d65247

Browse files
authored
Merge pull request #18151 from rifelpet/kubescheduler-docs
Add some clarification to KubeSchedulerConfiguration
2 parents eddf460 + b710329 commit 9d65247

3 files changed

Lines changed: 69 additions & 18 deletions

File tree

docs/addon_objects.md

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,71 @@
11
# Passing additional configuration objects
22

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.
44

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.
66

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+
```
830

931
# Well-Known Objects
1032

33+
Well-known objects receive special handling from kOps instead of being applied directly to the cluster.
34+
1135
## KubeSchedulerConfiguration (group: kubescheduler.config.k8s.io)
1236

1337
KubeSchedulerConfiguration objects allow for custom configuration of
1438
kube-scheduler, the component responsible for assigning Pods to Nodes.
1539

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.
1844

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
2057
```
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`.

docs/cluster_spec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,11 +867,11 @@ This block contains configurations for `kube-scheduler`. See https://kubernetes
867867
```yaml
868868
spec:
869869
kubeScheduler:
870-
usePolicyConfigMap: true
871870
enableProfiling: false
872871
```
873872

874-
Will make kube-scheduler use the scheduler policy from configmap "scheduler-policy" in namespace kube-system.
873+
For advanced scheduler configuration (e.g. custom profiles and plugins), see
874+
[addon_objects.md](addon_objects.md#kubeschedulerconfiguration-group-kubeschedulerconfigk8sio).
875875

876876
### LogFormat
877877

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
# This is an example "addon" object to provide additional/custom kube-scheduler configuration
2-
apiVersion: kubescheduler.config.k8s.io/v1beta2
1+
# This is an example "addon" object to provide custom kube-scheduler configuration.
2+
# Use with: kops create -f kubescheduler.yaml
3+
# Note: clientConnection.kubeconfig is managed by kOps and must not be set.
4+
apiVersion: kubescheduler.config.k8s.io/v1
35
kind: KubeSchedulerConfiguration
4-
clientConnection:
5-
burst: 100
6-
qps: 3.1
6+
profiles:
7+
- schedulerName: default-scheduler
8+
plugins:
9+
score:
10+
disabled:
11+
- name: NodeResourcesBalancedAllocation

0 commit comments

Comments
 (0)