Not able to create the daemonset from deployment yaml file as described in one o . . .

Mayur Sharma:
Not able to create the daemonset from deployment yaml file as described in one of the lab as follows:

Is anyone able to create it.

Steps given in lab are as follows:

An easy way to create a DaemonSet is to first generate a YAML file for a Deployment with the command 
kubectl create deployment elasticsearch --image=<http://k8s.gcr.io/fluentd-elasticsearch:1.20|k8s.gcr.io/fluentd-elasticsearch:1.20> -n kube-system --dry-run=client -o yaml &gt; fluentd.yaml 

Next, remove the replicas and strategy fields from the YAML file using a text editor. Also, change the kind from Deployment to DaemonSet.

Finally, create the Daemonset by running kubectl create -f fluentd.yaml

Fernando Jimenez:
I am able to do it with you initial imperative command for deployment, here’s the result

kubectl get daemonset -n kube-system
NAME            DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
calico-node     3         3         3       3            3           <http://kubernetes.io/os=linux|kubernetes.io/os=linux>   28m
elasticsearch   2         2         2       2            2           &lt;none&gt;                   22s
kube-proxy      3         3         3       3            3           <http://kubernetes.io/os=linux|kubernetes.io/os=linux>   28m

Here’s what the final applied fluentd.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: elasticsearch
  name: elasticsearch
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app: elasticsearch
  template:
    metadata:
      labels:
        app: elasticsearch
    spec:
      containers:
      - image: <http://k8s.gcr.io/fluentd-elasticsearch:1.20|k8s.gcr.io/fluentd-elasticsearch:1.20>
        name: fluentd-elasticsearch

Mayur Sharma:
Strange, when I ran it was giving error. expecting some more fields … let me retry the lab

Fernando Jimenez:
Please, compare the yaml I am posting with yours, as well.