elastic / elastic/docs-content

Document deploying agent on K8s for none K8s monitoring usage

Open
#7,776 14 comments 3 reactions 0 assignees View on GitHub
Team:SKI
Dominant language
No language data
Stars
47
Forks
261
Avg merge
3d 12h
Merged PRs (30d)
116

Description

Hi all,

We have many integrations that pull from various (cloud) APIs, as such one needs an Agent to run them on. (e.g. MISP, M365D, etc). However our how to deploy agent on k8s documentation assumes you are doing so to monitor k8s itself, thus we only document DaemonSet deployments. (e.g. https://www.elastic.co/guide/en/fleet/master/running-on-kubernetes-managed-by-fleet.html or https://www.elastic.co/guide/en/cloud-on-k8s/1.4/k8s-elastic-agent.html)

What if you just want an Agent to host integrations? You don't want or need DaemonSet, and probably shouldn't combine the two uses to the same policy and agents.

Please document the official supported way to deploy agent on k8s for remote or API based ingest. e.g. As a Deployment or perhaps a StatefulSet.

This is what I use, but its not official:
```
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ela-state-alpha
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 256Mi
storageClassName: standard-rwo
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: elastic-agent-alpha
name: elastic-agent-alpha
# namespace: ...
spec:
# Do not scale beyond 1
replicas: 1
selector:
matchLabels:
app: elastic-agent-alpha
strategy:
type: Recreate
template:
metadata:
labels:
app: elastic-agent-alpha
spec:
securityContext:
runAsUser: 0
runAsGroup: 0
containers:
- name: elastic-agent-alpha
image: docker.elastic.co/beats/elastic-agent:8.6.2
resources:
limits:
memory: 700Mi
requests:
cpu: 100m
memory: 400Mi
env:
- name: FLEET_ENROLL
value: "1"
- name: FLEET_INSECURE
value: "false"
- name: FLEET_URL
valueFrom:
secretKeyRef:
name: fleet-creds-alpha
key: url
- name: FLEET_ENROLLMENT_TOKEN
valueFrom:
secretKeyRef:
name: fleet-creds-alpha
key: token
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: ela-state-alpha
mountPath: "/usr/share/elastic-agent/state"
volumes:
- name: ela-state-alpha
persistentVolumeClaim:
claimName: ela-state-alpha
# Create secret
# kcn create secret generic fleet-creds-alpha --from-literal=url=">" --from-literal=token=""
# Duplicate for more agents to run other things
# for l in beta gamma delta epsilon zeta ; do sed -e "s/-alpha/-$l/g" < agent_alpha.yaml > agent_$l.yaml ; done
```

I've seen many broken customer agent deployment where they have tried to use our documentation to deploy Agent on k8s to have something to run their integrations on, they were not interested in k8s monitoring.

BR,
Thorben

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.