2

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 :(

Thür
  • 75
  • 1
  • 8
  • Please try with `apiVersion: extensions/v1beta1` – Aamir M Meman Dec 04 '19 at 20:41
  • I already tried it, but I get an error -> error: unable to recognize "cadvisor.daemonset.yaml": no matches for kind "DaemonSet" in version "extensions/v1beta1" – Thür Dec 04 '19 at 21:04
  • 3
    ``extensions/v1beta1`` has changed to ``apps/v1`` since kubernets 1.16, and now it requires new stuff. You can't use ``extensions/v1beta1`` – GuySoft Jul 30 '20 at 07:49

1 Answers1

10

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

Burak Serdar
  • 46,455
  • 3
  • 40
  • 59