大网数据广告活动
服务器运维问答

Having kube-dns scheduled on tainted nodes in GCP

· 52CE 我爱测

I have a GKE cluster with two node pools. One of those is a tainted node pools for use by specific pods. After adding the tainted node pool, I realised that Kubernetes was trying to schedule a kube-dns pod on the nodes of the poo…

问题原文

原帖链接 · Victor Noël · CC BY-SA 4.0

I have a GKE cluster with two node pools. One of those is a tainted node pools for use by specific pods.

After adding the tainted node pool, I realised that Kubernetes was trying to schedule a kube-dns pod on the nodes of the pool, but couldn't.

From what I understood, all nodes should have kube-dns deployed if I want DNS resolution to work. Maybe this is an incorrect assumption?

Since kube-dns (and other things in kube-system) are managed by GKE and not by me, I have no idea how to either:

  • if it's needed, tell kube-dns to tolerate my node pool, or
  • if it's not needed, tell kube-dns not to be scheduled on it.

已采纳解答

原帖链接 · Mark · CC BY-SA 4.0

Currently using 1.1.5.12.-gke you should have deployed at least:

  • kube-dns deployment
  • kube-dns-autoscaler deployment

According to the docs kube-dns-autoscaler:

kube-dns scales to serve the DNS demands of the cluster. This scaling is controlled by the kube-dns-autoscaler which is deployed by default in all GKE clusters. kube-dns-autoscaler adjusts the number of replicas in the kube-dns deployment based on the number of nodes and cores in the cluster.

Preferred way of tuning kube-dns in the cluster should by:

  • By configuring kube-dns-autoscaler ConfigMap


    linear: '{"coresPerReplica":256,"min":1,"nodesPerReplica":16, "preventSinglePointFailure": true}'

where:

"preventSinglePointFailure": true controller ensures at least 2 replicas if there are more than one node.

Using this this parameters for current replicas it will be calculated as:

    replicas = max( ceil( cores × 1/coresPerReplica ) , ceil( nodes × 1/nodesPerReplica ) )

  • Manually:
    kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system
    kubectl scale --replicas=1 deployment/kube-dns --namespace=kube-system

Currently the problem you have experienced arises from default kube-dns deployment configuration:

toleration:
    - key: CriticalAddonsOnly
      operator: Exists
    - key: components.gke.io/gke-managed-components
      operator: Exists

This configuration prevent possibility to schedule pods on the nodes with your custom taints.

I would suggest to verify - why your pods can't be scheduled in the cluster in default-pool (probably due to lack of resources in the default-pool) and I would consider resizing this default-pool.

Another solution is to deploy custom kube-dns or core-dns configuration.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-02-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。