Skip to content

Instantly share code, notes, and snippets.

@akrzos-bw
Created January 16, 2020 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akrzos-bw/eca6fbd119cb19e7d72fa2ca7d2ac0fb to your computer and use it in GitHub Desktop.
Save akrzos-bw/eca6fbd119cb19e7d72fa2ca7d2ac0fb to your computer and use it in GitHub Desktop.
OpenShift heartbeat-deploy.yaml
---
apiVersion: project.openshift.io/v1
kind: Project
metadata:
name: akrzos-heartbeat
annotations:
openshift.io/node-selector: ""
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: heartbeat
namespace: akrzos-heartbeat
labels:
k8s-app: heartbeat
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: heartbeat
labels:
k8s-app: heartbeat
rules:
- apiGroups: [""]
resources:
- namespaces
- pods
verbs:
- get
- watch
- list
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: heartbeat
subjects:
- kind: ServiceAccount
name: heartbeat
namespace: akrzos-heartbeat
roleRef:
kind: ClusterRole
name: heartbeat
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: heartbeat
namespace: akrzos-heartbeat
labels:
k8s-app: heartbeat
spec:
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: heartbeat
template:
metadata:
labels:
k8s-app: heartbeat
spec:
containers:
- name: heartbeat
image: docker.elastic.co/beats/heartbeat:7.5.1
imagePullPolicy: IfNotPresent
args:
- "-e"
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
securityContext:
runAsUser: 0
privileged: true
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- name: heartbeat-config
mountPath: /usr/share/heartbeat/heartbeat.yml
readOnly: true
subPath: heartbeat.yml
- name: heartbeat-icmp
mountPath: /usr/share/heartbeat/monitors.d/heartbeat-icmp.yml
readOnly: true
subPath: heartbeat-icmp.yml
hostNetwork: true
serviceAccountName: heartbeat
volumes:
- name: heartbeat-config
configMap:
defaultMode: 0600
name: heartbeat-config
- name: heartbeat-icmp
configMap:
defaultMode: 0600
name: heartbeat-icmp
---
apiVersion: v1
kind: ConfigMap
metadata:
name: heartbeat-config
namespace: akrzos-heartbeat
data:
heartbeat.yml: |
# See https://www.elastic.co/guide/en/beats/heartbeat/current/heartbeat-reference-yml.html for reference
heartbeat.config.monitors:
# Directory + glob pattern to search for configuration files
path: /usr/share/heartbeat/monitors.d/*.yml
# If enabled, heartbeat will periodically check the config.monitors path for changes
reload.enabled: true
# How often to check for changes
reload.period: 15s
logging.json: true
output.kafka:
hosts: ["..."]
topic: "heartbeat"
version: 1.1.0
username: "..."
password: "..."
---
apiVersion: v1
kind: ConfigMap
metadata:
name: heartbeat-icmp
namespace: akrzos-heartbeat
data:
heartbeat-icmp.yml: |
- type: icmp
schedule: '*/5 * * * * * *'
hosts:
- ...
- ...
mode: all
ipv4: true
timeout: 16s
wait: 1s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment