mirror of https://github.com/k3s-io/k3s
Merge pull request #1275 from louiznk/feat/toleration/control_plane
feat: add NoSchedule toleration on key node-role.kubernetes.io/masterpull/1585/head
commit
ceb6bfbbf3
|
@ -99,6 +99,9 @@ spec:
|
||||||
tolerations:
|
tolerations:
|
||||||
- key: "CriticalAddonsOnly"
|
- key: "CriticalAddonsOnly"
|
||||||
operator: "Exists"
|
operator: "Exists"
|
||||||
|
- key: "node-role.kubernetes.io/master"
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoSchedule"
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
beta.kubernetes.io/os: linux
|
beta.kubernetes.io/os: linux
|
||||||
containers:
|
containers:
|
||||||
|
|
|
@ -51,6 +51,12 @@ spec:
|
||||||
app: local-path-provisioner
|
app: local-path-provisioner
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: local-path-provisioner-service-account
|
serviceAccountName: local-path-provisioner-service-account
|
||||||
|
tolerations:
|
||||||
|
- key: "CriticalAddonsOnly"
|
||||||
|
operator: "Exists"
|
||||||
|
- key: "node-role.kubernetes.io/master"
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoSchedule"
|
||||||
containers:
|
containers:
|
||||||
- name: local-path-provisioner
|
- name: local-path-provisioner
|
||||||
image: rancher/local-path-provisioner:v0.0.11
|
image: rancher/local-path-provisioner:v0.0.11
|
||||||
|
|
|
@ -23,6 +23,12 @@ spec:
|
||||||
k8s-app: metrics-server
|
k8s-app: metrics-server
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: metrics-server
|
serviceAccountName: metrics-server
|
||||||
|
tolerations:
|
||||||
|
- key: "CriticalAddonsOnly"
|
||||||
|
operator: "Exists"
|
||||||
|
- key: "node-role.kubernetes.io/master"
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoSchedule"
|
||||||
volumes:
|
volumes:
|
||||||
# mount in tmp so we can safely use from-scratch images and/or read-only containers
|
# mount in tmp so we can safely use from-scratch images and/or read-only containers
|
||||||
- name: tmp-dir
|
- name: tmp-dir
|
||||||
|
|
|
@ -5,9 +5,21 @@ metadata:
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
spec:
|
spec:
|
||||||
chart: https://%{KUBERNETES_API}%/static/charts/traefik-1.81.0.tgz
|
chart: https://%{KUBERNETES_API}%/static/charts/traefik-1.81.0.tgz
|
||||||
set:
|
valuesContent: |-
|
||||||
rbac.enabled: "true"
|
rbac:
|
||||||
ssl.enabled: "true"
|
enabled: true
|
||||||
metrics.prometheus.enabled: "true"
|
ssl:
|
||||||
kubernetes.ingressEndpoint.useDefaultPublishedService: "true"
|
enabled: true
|
||||||
|
metrics:
|
||||||
|
prometheus:
|
||||||
|
enabled: true
|
||||||
|
kubernetes:
|
||||||
|
ingressEndpoint:
|
||||||
|
useDefaultPublishedService: true
|
||||||
image: "rancher/library-traefik"
|
image: "rancher/library-traefik"
|
||||||
|
tolerations:
|
||||||
|
- key: "CriticalAddonsOnly"
|
||||||
|
operator: "Exists"
|
||||||
|
- key: "node-role.kubernetes.io/master"
|
||||||
|
operator: "Exists"
|
||||||
|
effect: "NoSchedule"
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -356,6 +356,22 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
|
||||||
|
|
||||||
ds.Spec.Template.Spec.Containers = append(ds.Spec.Template.Spec.Containers, container)
|
ds.Spec.Template.Spec.Containers = append(ds.Spec.Template.Spec.Containers, container)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add toleration to noderole.kubernetes.io/master=*:NoSchedule
|
||||||
|
noScheduleToleration := core.Toleration{
|
||||||
|
Key: "noderole.kubernetes.io/master",
|
||||||
|
Operator: "Exists",
|
||||||
|
Effect: "NoSchedule",
|
||||||
|
}
|
||||||
|
ds.Spec.Template.Spec.Tolerations = append(ds.Spec.Template.Spec.Tolerations, noScheduleToleration)
|
||||||
|
|
||||||
|
// Add toleration to CriticalAddonsOnly
|
||||||
|
criticalAddonsOnlyToleration := core.Toleration{
|
||||||
|
Key: "CriticalAddonsOnly",
|
||||||
|
Operator: "Exists",
|
||||||
|
}
|
||||||
|
ds.Spec.Template.Spec.Tolerations = append(ds.Spec.Template.Spec.Tolerations, criticalAddonsOnlyToleration)
|
||||||
|
|
||||||
// Add node selector only if label "svccontroller.k3s.cattle.io/enablelb" exists on the nodes
|
// Add node selector only if label "svccontroller.k3s.cattle.io/enablelb" exists on the nodes
|
||||||
selector, err := labels.Parse(daemonsetNodeLabel)
|
selector, err := labels.Parse(daemonsetNodeLabel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue