Missing required field in DaemonSet

12/4/2019

I'm trying to run Cadvisor on a Kubernetes cluster following this doc https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/

Contents of the yaml file below:

apiVersion: v1
kind: Namespace
metadata:
  name: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: cadvisor
  namespace: kube-system
  labels:
    name: cadvisor
spec:
  selector:
    matchLabels:
      name: cadvisor
  template:
    metadata:
      labels:
        name: cadvisor
    spec:
      containers:
      - image: google/cadvisor:latest
        name: cadvisor
        ports:
        - containerPort: 8080
      restartPolicy: Always
status: {}

But when I try to deploy it :

kubectl apply -f cadvisor.daemonset.yaml

I get the output + error:

error: error validating "cadvisor.daemonset.yaml": error validating data: [ValidationError(DaemonSet.status): missing required field "currentNumberScheduled" in io.k8s.api.apps.v1.DaemonSetStatus, ValidationError(DaemonSet.status): missing required field "numberMisscheduled" in io.k8s.api.apps.v1.DaemonSetStatus, ValidationError(DaemonSet.status): missing required field "desiredNumberScheduled" in io.k8s.api.apps.v1.DaemonSetStatus, ValidationError(DaemonSet.status): missing required field "numberReady" in io.k8s.api.apps.v1.DaemonSetStatus]; if you choose to ignore these errors, turn validation off with --validate=false

But there is no infos about these required fields in the documentation or anywhere on Google :(

-- Thur
cadvisor
daemonset
kubernetes

1 Answer

12/4/2019

Do not pass status: {} in the yaml when creating resources. That field is only for status information returned from the API server.

-- Burak Serdar
Source: StackOverflow