rancher: [BUG] - Tolerations are not propagated to Fleet clusters
Rancher Server Setup
- Rancher version: 2.11-alpha3
- Installation option (Docker install/Helm Chart): helm chart
- If Helm Chart, Kubernetes Cluster and version (RKE1, RKE2, k3s, EKS, etc): k3s
Information about the Cluster
- Kubernetes version: v1.31.5
- Cluster Type (Local/Downstream): Local
User Information
- What is the role of the user logged in? Admin
Describe the bug This was discovered when testing Fleet with all nodes tainted when looking for: SURE-8883
I’m deploying rancher in a cluster with all nodes tainted with key1=value:NoSchedule
I’m passing extraToleration values when installing Rancher:
--set "extraTolerations[0].key=key1" --set "extraTolerations[0].value=value" --set "extraTolerations[0].effect=NoSchedule"
Rancher is deploying fine. The main controllers for Fleet are also deploying fine and have the expected tolerations:
$kubectl get pod -n cattle-fleet-system fleet-controller-6d6988bdb-5sm5j -o jsonpath={.spec.tolerations} | jq
[
{
"effect": "NoSchedule",
"key": "cattle.io/os",
"operator": "Equal",
"value": "linux"
},
{
"effect": "NoSchedule",
"key": "key1",
"operator": "Equal",
"value": "value"
},
{
"effect": "NoExecute",
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"tolerationSeconds": 300
},
{
"effect": "NoExecute",
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"tolerationSeconds": 300
}
]
$ kubectl get pod -n cattle-fleet-system gitjob-67df848c54-54ztt -o jsonpath={.spec.tolerations} | jq
[
{
"effect": "NoSchedule",
"key": "cattle.io/os",
"operator": "Equal",
"value": "linux"
},
{
"effect": "NoSchedule",
"key": "key1",
"operator": "Equal",
"value": "value"
},
{
"effect": "NoExecute",
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"tolerationSeconds": 300
},
{
"effect": "NoExecute",
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"tolerationSeconds": 300
}
]
The local Fleet agent is pending.
$ kubectl get pods -n cattle-fleet-local-system
NAME READY STATUS RESTARTS AGE
fleet-agent-0 0/2 Pending 0 4m31s
Obviously it doesn’t have the expected tolerations.
The root cause seems to be the Fleet cluster, as it does not have the tolerations neither (they should go in the agentTolerations value)
$ k get -n fleet-local cluster.fleet.cattle.io local -o jsonpath={.spec} | jq
{
"agentAffinity": {
"nodeAffinity": {
"preferredDuringSchedulingIgnoredDuringExecution": [
{
"preference": {
"matchExpressions": [
{
"key": "fleet.cattle.io/agent",
"operator": "In",
"values": [
"true"
]
}
]
},
"weight": 1
}
]
}
},
"agentNamespace": "cattle-fleet-local-system",
"clientID": "zgs9p5njzmtj7ccvf6f4gp8vlmdc9247bsx6d86gb9xjgbfmc9qkrs",
"kubeConfigSecret": "local-kubeconfig",
"kubeConfigSecretNamespace": "fleet-local"
}
Patching the cluster with the expected tolerations fixes the issue:
$ cat tolerations-patch.yaml
spec:
agentTolerations:
- effect: NoSchedule
key: key1
value: value
$ kubectl patch -n fleet-local clusters.fleet.cattle.io local --type merge --patch-file tolerations-patch.yaml
cluster.fleet.cattle.io/local patched
After a new seconds, the agent is scheduled and running fine (and has the expected tolerations):
$ kubectl get pods -n cattle-fleet-local-system
NAME READY STATUS RESTARTS AGE
fleet-agent-0 2/2 Running 0 18s
$ kubectl get -n fleet-local cluster.fleet.cattle.io local -o jsonpath={.spec.agentTolerations} | jq
[
{
"effect": "NoSchedule",
"key": "key1",
"value": "value"
}
]
To Reproduce Follow the description of the issue.
When creating the fleet cluster, it should also pass the Control Plane tolerations, as it does when deploying Fleet or any other chart.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (9 by maintainers)
Commits related to this issue
- Adds CP taints to Fleet's local cluster tolerations Adds the control plane nodes taints to tolerations in the local cluster created by Fleet. Those tolerations will be propagated to the Fleet agent, ... — committed to 0xavi0/rancher by 0xavi0 2 years ago
- Adds CP taints to Fleet's local cluster tolerations Adds the control plane nodes taints to tolerations in the local cluster created by Fleet. Those tolerations will be propagated to the Fleet agent, ... — committed to 0xavi0/rancher by 0xavi0 2 years ago
- Adds CP taints to Fleet's local cluster tolerations Adds the control plane nodes taints to tolerations in the local cluster created by Fleet. Those tolerations will be propagated to the Fleet agent, ... — committed to 0xavi0/rancher by 0xavi0 2 years ago
- Adds CP taints to Fleet's local cluster tolerations Adds the control plane nodes taints to tolerations in the local cluster created by Fleet. Those tolerations will be propagated to the Fleet agent, ... — committed to chiukapoor/rancher by 0xavi0 2 years ago
Hi @gaktive and @momesgin
I think there was some confusion here when linking this issue with SURE-9823. This issue was created exclusively to implement some requirement Fleet needed to support tolerations for new clusters (Fleet clusters) and, as @mmartin24 has tested and confirmed that seems to be fixed.
I’ve deleted the Jira issue from the title and we also added a comment on the Jira because helm-operation pods have nothing to do with Fleet.
I’ll allow @momesgin to chime in since UI had been previously blocked by this.
Thanks @snasovich for the long answer. Since we are sharing ownership on fleetchart.go and fleetcluster.go, we will make the necessary changes to the local agent’s startup.
Summary from Discussion in Fleet Daily:
There is already a way to configure tolerations for the fleet-agents. For the local agent, we want to make this automatic in a future version, by adopting the
cattle-cluster-agentapproach in the fleetcluster.go for the local agent. That way the local agent will start, just like other Rancher components.@Sahota1225 - I was totally wrong and this is almost definitely you guys. Can you have someone take a look?