Skip to content

Instantly share code, notes, and snippets.

@megastef
Created October 2, 2019 14:56
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 megastef/a66760dca0830d773d8c531de746d9fe to your computer and use it in GitHub Desktop.
Save megastef/a66760dca0830d773d8c531de746d9fe to your computer and use it in GitHub Desktop.
Logagent with cluster role
# st-agent-clusterrole.yml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sematext-agent
labels:
app: sematext-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: sematext-agent
subjects:
- kind: ServiceAccount
name: sematext-agent
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: sematext-agent
labels:
app: sematext-agent
rules:
- apiGroups:
- ""
resources:
- events
- pods
- configmaps
- nodes
- secrets
verbs:
- list
- get
- watch
- apiGroups:
- ""
resources:
- pods
- configmaps
verbs:
- create
- delete
- update
- apiGroups:
- apps
resources:
- deployments
verbs:
- watch
- list
# run the following command
# kubectl create -f st-agent-clusterrole.yml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: st-logagent
spec:
selector:
matchLabels:
app: st-logagent
template:
metadata:
labels:
app: st-logagent
spec:
serviceAccountName: sematext-agent
hostNetwork: true
dnsPolicy: "ClusterFirst"
restartPolicy: "Always"
containers:
- name: logagent
image: sematext/logagent:latest
imagePullPolicy: "Always"
env:
- name: LOGS_TOKEN
value: "YOUR_TOKEN_HERE"
- name: REGION
value: "EU"
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-sock
- mountPath: /etc/localtime
name: localtime
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
- name: localtime
hostPath:
path: /etc/localtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment