Add the instruction on how to configure nodeSelector, tolerations and affinity (#4277)

* Add the instruction on how to configure nodeSelector, tolerations and affinity

* Keep the docs consistent in terms of the syntax
This commit is contained in:
Vincent 2021-10-11 12:46:16 -04:00 committed by GitHub
parent cbdb2d7ce8
commit 1e3e7b1a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 172 additions and 5 deletions

View File

@ -10,8 +10,6 @@ aliases:
You can configure the Knative Eventing operator by modifying settings in the KnativeEventing custom resource (CR). You can configure the Knative Eventing operator by modifying settings in the KnativeEventing custom resource (CR).
**NOTE:** Kubernetes spec level policies cannot be configured using the Knative Operators.
<!--TODO: break this into sub sections like for the channels sections, i.e. a page per topic--> <!--TODO: break this into sub sections like for the channels sections, i.e. a page per topic-->
## Installing a specific version of Eventing ## Installing a specific version of Eventing
@ -316,3 +314,100 @@ spec:
cpu: 1000m cpu: 1000m
memory: 250Mi memory: 250Mi
``` ```
### Override the nodeSelector
The KnativeEventing resource is able to override the nodeSelector for the Knative Eventing deployment resources.
For example, if you would like to add the following tolerations
```yaml
nodeSelector:
disktype: hdd
```
to the deployment `eventing-controller`, you need to change your KnativeEventing CR as below:
```yaml
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeEventing
metadata:
name: knative-eventing
namespace: knative-eventing
spec:
deployments:
- name: eventing-controller
nodeSelector:
disktype: hdd
```
### Override the tolerations
The KnativeEventing resource is able to override tolerations for the Knative Eventing deployment resources.
For example, if you would like to add the following tolerations
```yaml
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
```
to the deployment `eventing-controller`, you need to change your KnativeEventing CR as below:
```yaml
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeEventing
metadata:
name: knative-eventing
namespace: knative-eventing
spec:
deployments:
- name: eventing-controller
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
```
### Override the affinity
The KnativeEventing resource is able to override the affinity, including nodeAffinity, podAffinity, and podAntiAffinity,
for the Knative Eventing deployment resources. For example, if you would like to add the following nodeAffinity
```yaml
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: disktype
operator: In
values:
- ssd
```
to the deployment `activator`, you need to change your KnativeEventing CR as below:
```yaml
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeEventing
metadata:
name: knative-eventing
namespace: knative-eventing
spec:
deployments:
- name: activator
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: disktype
operator: In
values:
- ssd
```

View File

@ -468,7 +468,7 @@ while other system deployments have `2` Replicas by using `spec.high-availabilit
apiVersion: operator.knative.dev/v1alpha1 apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing kind: KnativeServing
metadata: metadata:
name: ks name: knative-serving
namespace: knative-serving namespace: knative-serving
spec: spec:
high-availability: high-availability:
@ -485,7 +485,7 @@ spec:
!!! note !!! note
The KnativeServing resource `label` and `annotation` settings override the webhook's labels and annotations for both Deployments and Pods. The KnativeServing resource `label` and `annotation` settings override the webhook's labels and annotations for both Deployments and Pods.
### Override nodeSelector ### Override the nodeSelector
The following KnativeServing resource overrides the `webhook` deployment to use the `disktype: hdd` nodeSelector: The following KnativeServing resource overrides the `webhook` deployment to use the `disktype: hdd` nodeSelector:
@ -493,7 +493,7 @@ The following KnativeServing resource overrides the `webhook` deployment to use
apiVersion: operator.knative.dev/v1alpha1 apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing kind: KnativeServing
metadata: metadata:
name: ks name: knative-serving
namespace: knative-serving namespace: knative-serving
spec: spec:
deployments: deployments:
@ -501,3 +501,75 @@ spec:
nodeSelector: nodeSelector:
disktype: hdd disktype: hdd
``` ```
### Override the tolerations
The KnativeServing resource is able to override tolerations for the Knative Serving deployment resources.
For example, if you would like to add the following tolerations
```yaml
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
```
to the deployment `activator`, you need to change your KnativeServing CR as below:
```yaml
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
deployments:
- name: activator
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
```
### Override the affinity
The KnativeServing resource is able to override the affinity, including nodeAffinity, podAffinity, and podAntiAffinity,
for the Knative Serving deployment resources. For example, if you would like to add the following nodeAffinity
```yaml
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: disktype
operator: In
values:
- ssd
```
to the deployment `activator`, you need to change your KnativeServing CR as below:
```yaml
apiVersion: operator.knative.dev/v1alpha1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
deployments:
- name: activator
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: disktype
operator: In
values:
- ssd
```