Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastic agent on k8s #19727

Merged
merged 6 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions deploy/kubernetes/elastic-agent-kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: agent-ingest-management-nodescope
namespace: kube-system
labels:
app: agent-ingest-management-nodescope
group: ingest-management
spec:
selector:
matchLabels:
app: agent-ingest-management-nodescope
template:
metadata:
labels:
app: agent-ingest-management-nodescope
group: ingest-management
spec:
serviceAccountName: agent-ingest-management
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: agent-ingest-management-nodescope
image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
env:
- name: FLEET_ENROLL
value: "1"
# Use enrollment key of node scope configuration to distinguish node scope datasets
- name: FLEET_ENROLLMENT_TOKEN
value:
- name: KIBANA_HOST
value: "http://kibana:5601"
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
securityContext:
runAsUser: 0
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-ingest-management-clusterscope
namespace: kube-system
labels:
app: agent-ingest-management-clusterscope
group: ingest-management
spec:
selector:
matchLabels:
app: agent-ingest-management-clusterscope
template:
metadata:
labels:
app: agent-ingest-management-clusterscope
group: ingest-management
spec:
serviceAccountName: agent-ingest-management
containers:
- name: agent-ingest-management-clusterscope
image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
env:
- name: FLEET_ENROLL
value: "1"
# Use enrollment key of cluster scope configuration to distinguish node scope datasets
- name: FLEET_ENROLLMENT_TOKEN
value:
- name: KIBANA_HOST
value: "http://kibana:5601"
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
securityContext:
runAsUser: 0
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: agent-ingest-management
subjects:
- kind: ServiceAccount
name: agent-ingest-management
namespace: kube-system
roleRef:
kind: ClusterRole
name: agent-ingest-management
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: agent-ingest-management
labels:
k8s-app: agent-ingest-management
rules:
- apiGroups: [""]
resources:
- nodes
- namespaces
- events
- pods
- secrets
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
resources:
- replicasets
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources:
- statefulsets
- deployments
- replicasets
verbs: ["get", "list", "watch"]
- apiGroups:
- ""
resources:
- nodes/stats
verbs:
- get
# required for apiserver
- nonResourceURLs:
- "/metrics"
verbs:
- get
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: agent-ingest-management
namespace: kube-system
labels:
k8s-app: agent-ingest-management
---
44 changes: 44 additions & 0 deletions deploy/kubernetes/elastic-agent/elastic-agent-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: agent-ingest-management-nodescope
namespace: kube-system
labels:
app: agent-ingest-management-nodescope
group: ingest-management
spec:
selector:
matchLabels:
app: agent-ingest-management-nodescope
template:
metadata:
labels:
app: agent-ingest-management-nodescope
group: ingest-management
spec:
serviceAccountName: agent-ingest-management
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: agent-ingest-management-nodescope
image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
env:
- name: FLEET_ENROLL
value: "1"
# Use enrollment key of node scope configuration to distinguish node scope datasets
- name: FLEET_ENROLLMENT_TOKEN
value:
- name: KIBANA_HOST
value: "http://kibana:5601"
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
securityContext:
runAsUser: 0
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
42 changes: 42 additions & 0 deletions deploy/kubernetes/elastic-agent/elastic-agent-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: agent-ingest-management-clusterscope
namespace: kube-system
labels:
app: agent-ingest-management-clusterscope
group: ingest-management
spec:
selector:
matchLabels:
app: agent-ingest-management-clusterscope
template:
metadata:
labels:
app: agent-ingest-management-clusterscope
group: ingest-management
spec:
serviceAccountName: agent-ingest-management
containers:
- name: agent-ingest-management-clusterscope
image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
env:
- name: FLEET_ENROLL
value: "1"
# Use enrollment key of cluster scope configuration to distinguish node scope datasets
- name: FLEET_ENROLLMENT_TOKEN
value:
- name: KIBANA_HOST
value: "http://kibana:5601"
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
securityContext:
runAsUser: 0
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
12 changes: 12 additions & 0 deletions deploy/kubernetes/elastic-agent/elastic-agent-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: agent-ingest-management
subjects:
- kind: ServiceAccount
name: agent-ingest-management
namespace: kube-system
roleRef:
kind: ClusterRole
name: agent-ingest-management
apiGroup: rbac.authorization.k8s.io
36 changes: 36 additions & 0 deletions deploy/kubernetes/elastic-agent/elastic-agent-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: agent-ingest-management
labels:
k8s-app: agent-ingest-management
rules:
- apiGroups: [""]
resources:
- nodes
- namespaces
- events
- pods
- secrets
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
resources:
- replicasets
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources:
- statefulsets
- deployments
- replicasets
verbs: ["get", "list", "watch"]
- apiGroups:
- ""
resources:
- nodes/stats
verbs:
- get
# required for apiserver
- nonResourceURLs:
- "/metrics"
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: agent-ingest-management
namespace: kube-system
labels:
k8s-app: agent-ingest-management
Loading