☸️

NodeにTaintsがついている場合、Datadog DaemonSetにTolerationsを忘れないでね!

2024/01/29に公開

マネージド型k8sのDaemonSet

EKSなどのKubernetesマネージドサービスは、DaemonSetを介してNodeにkube-proxy, ebs csi, cniなどのPodを適切に配置してくれます。

k8sドキュメントに記載している自動的に追加されるTolerations以外で、ワイルドカードのTolerationsもデフォルトで入っています。

tolerations:                       
- operator: Exists

EKS管轄外のDaemonSet

しかし、DatadogなどEKS外でデプロイされたDaemonSet Podsを入れる際に、TaintsがついているNodeにPodがスケジューリングされないため、注意が必要です。
解決方法としては、ドキュメントに書かれているように

https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#taints-and-tolerations

You can add your own tolerations to the Pods of a DaemonSet as well, by defining these in the Pod template of the DaemonSet.

DaemonSetのPodテンプレートにtolerationsを定義することです。

tolerations:                       
- operator: Exists

また、このようなワイルドカードのTolerationsを追加するのは便利かもしれないですが、(EKSの場合)Fargateにスケジューリングされてしまうので、Affinityもちゃんと書きましょう

affinity:                               
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
        - matchExpressions:
          - key: eks.amazonaws.com/compute-type
            operator: NotIn              
            values:
              - fargat

余談ですが、同じくDaemonSet介してデプロイされるfluent bitでは、不必要なTolerationsによるバグが過去起きていました。

https://github.com/aws-samples/amazon-cloudwatch-container-insights/issues/61

Discussion