Skip to content

Latest commit

 

History

History
99 lines (73 loc) · 1.89 KB

15-Practice-Test-DaemonSets.md

File metadata and controls

99 lines (73 loc) · 1.89 KB

Practice Test - DaemonSets

Solutions to practice test daemonsets

  • Run the command kubectl get daemonsets --all-namespaces

    $ kubectl get daemonsets --all-namespaces
    
  • Run the command kubectl get daemonsets --all-namespaces

    $ kubectl get daemonsets --all-namespaces
    
  • Run the command kubectl get all --all-namespaces and identify the types

    $ kubectl get all --all-namespaces
    
  • Run the command kubectl describe daemonset kube-proxy --namespace=kube-system

    $ kubectl describe daemonset kube-proxy --namespace=kube-system
    
  • Run the command kubectl describe daemonset kube-flannel-ds-amd64 --namespace=kube-system

    $ kubectl describe daemonset kube-flannel-ds-amd64 --namespace=kube-system
    
  • Create a daemonset

    $ vi ds.yaml
    
    apiVersion: apps/v1
    kind: DaemonSet
    metadata:
      name: elasticsearch
      namespace: kube-system
      labels:
        k8s-app: fluentd-logging
    spec:
      selector:
        matchLabels:
          name: elasticsearch
      template:
        metadata:
          labels:
            name: elasticsearch
        spec:
          tolerations:
          # this toleration is to have the daemonset runnable on master nodes
          # remove it if your masters can't run pods
          - key: node-role.kubernetes.io/master
            effect: NoSchedule
          containers:
          - name: elasticsearch
            image: k8s.gcr.io/fluentd-elasticsearch:1.20
    
  • To create the daemonset and list the daemonsets and pods

    $ kubectl create -f ds.yaml
    $ kubectl get ds -n kube-system
    $ kubectl get pod -n kube-system|grep elasticsearch