Adding a PodDisruptionBudget to fluentd-gcp pods in GKE

8/7/2019

My fluentd-gcp pods are like the following:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    scheduler.alpha.kubernetes.io/critical-pod: ""
  creationTimestamp: 2019-08-06T23:41:17Z
  generateName: fluentd-gcp-v3.1.1-
  labels:
    controller-revision-hash: 7cbbc7496
    k8s-app: fluentd-gcp
    kubernetes.io/cluster-service: "true"
    pod-template-generation: "4"
    version: v3.1.1
  name: fluentd-gcp-v3.1.1-jpd5x
  namespace: kube-system

I tried to add a Pod Disruption Budget like this

apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: fluentd-gcp
spec:
  minAvailable: 1
  selector:
    matchLabels:
      app: fluentd-gcp    

However, the allowed disruptions value is 0

$ kubectl get pdb
NAME               MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
fluentd-gcp        1               N/A               0                     9s

which indicates that there is no matching pod with that label as mentioned here https://kubernetes.io/docs/tasks/run-application/configure-pdb/#check-the-status-of-the-pdb

Am I missing something?

-- kosta
google-kubernetes-engine
kubernetes

1 Answer

8/9/2019

ALLOWED DISRUPTIONS describes pods that are candidates for eviction rather than the number of pods the PDB has seen.

If you do $ kubectl describe pdb NAME, you'll see the current field, which describes accurately how many pods are being matched by the PDB using the mentioned labels.

Although is not specified in your question, consider that by default in GKE fluentd-gcp is run as a DaemonSet, this means that the number of replicas depends on the number of nodes in the cluster.

This would prevent the PDB to mark these pods as evictable, as they depend on the nodes rather than the number in the ReplicaSet.

-- yyyyahir
Source: StackOverflow