apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: my-ds
spec:
  template:
    metadata:
      labels:
        app: my-ds
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: app
        image: alpine:3.5
        ports:
        - containerPort: 5000
        command:
        - /bin/sh
        - -c
        - >
          while true; do
            echo -e "HTTP/1.1 200 OK\n\n$(hostname)-v-$(cat /etc/alpine-release) is running..." | nc -w 1 -lp 5000
          done
        env:
        - name: DEMO
          value: "0"
  minReadySeconds: 10
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
---
kind: Service
apiVersion: v1
metadata:
  name: my-ds-svc
  labels:
    app: my-ds
spec:
  selector:
    app: my-ds
  ports:
    - protocol: TCP
      port: 80
      targetPort: 5000
      name: http
