Skip to content

Commit f2af0da

Browse files
barkbaynaemono
andauthored
Initial version of GKE Autopilot documentation. (#6760) (#6843)
* Initial version of autopilot documentation. Signed-off-by: Michael Montgomery <[email protected]> Co-authored-by: Michael Morello <[email protected]> Co-authored-by: Michael Montgomery <[email protected]>
1 parent 843be8e commit f2af0da

File tree

9 files changed

+1151
-10
lines changed

9 files changed

+1151
-10
lines changed

config/recipes/autopilot/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
= GKE Autopilot Configuration Examples
2+
3+
This directory contains yaml manifests with an configurations for running Elasticsearch, Kibana, Fleet Server, Elastic Agent and Metricbeat on GKE Autopilot. These manifests are self-contained and work out-of-the-box on any GKE Autopilot cluster with a version greater than 1.25.
4+
5+
IMPORTANT: These examples are for illustration purposes only and should not be considered to be production-ready.
6+
7+
NOTE: The Elasticsearch example uses a Daemonset to set to ensure that `/proc/sys/vm/max_map_count` is set on all of the underlying Kubernetes nodes for optimal performance. See https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html for more information.
8+
9+
==== Elasticsearch, Kibana and Elastic Agent in Fleet mode
10+
11+
===== Agent with System and Kubernetes integrations - `elasticsearch.yaml`+`fleet-kubernetes-integration.yaml`
12+
13+
Deploys Elastic Agent as a DaemonSet in Fleet mode with System and Kubernetes integrations enabled. System integration collects syslog logs, auth logs and system metrics (for CPU, I/O, filesystem, memory, network, process and others). Kubernetes integrations collects API server, Container, Event, Node, Pod, Volume and system metrics.
14+
15+
===== Kubernetes integration - `elasticsearch.yaml`+`kubernetes-integration.yaml`
16+
17+
Deploys Elastic Agent as a DaemonSet in standalone mode with Kubernetes integration enabled. Collects API server, Container, Event, Node, Pod, Volume, System, Volume, and State metrics for Containers, Daemonsets, Jobs, Nodes, Persistent volumes/claims, Pods, Replicasets, ResourceQuotas, Services, Statefulsets, and StorageClasses.
18+
19+
==== Metricbeat for Kubernetes monitoring - `elasticsearch.yaml`+`metricbeat_hosts.yaml`
20+
21+
Deploys Metricbeat as a DaemonSet that monitors the host resource usage (CPU, memory, network, filesystem) and Kubernetes resources (Nodes, Pods, Containers, Volumes).
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: DaemonSet
4+
metadata:
5+
name: max-map-count-setter
6+
labels:
7+
k8s-app: max-map-count-setter
8+
spec:
9+
selector:
10+
matchLabels:
11+
name: max-map-count-setter
12+
template:
13+
metadata:
14+
labels:
15+
name: max-map-count-setter
16+
spec:
17+
nodeSelector:
18+
cloud.google.com/compute-class: "Balanced"
19+
initContainers:
20+
- name: max-map-count-setter
21+
image: docker.io/bash:5.2.15
22+
resources:
23+
requests:
24+
cpu: 10m
25+
memory: 16Mi
26+
limits:
27+
cpu: 10m
28+
memory: 16Mi
29+
securityContext:
30+
privileged: true
31+
runAsUser: 0
32+
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 262144 > /proc/sys/vm/max_map_count']
33+
containers:
34+
- name: sleep
35+
image: docker.io/bash:5.2.15
36+
command: ['sleep', 'infinity']
37+
---
38+
apiVersion: elasticsearch.k8s.elastic.co/v1
39+
kind: Elasticsearch
40+
metadata:
41+
name: elasticsearch
42+
spec:
43+
version: 8.7.0
44+
nodeSets:
45+
- name: default
46+
count: 1
47+
podTemplate:
48+
spec:
49+
nodeSelector:
50+
cloud.google.com/compute-class: "Balanced"
51+
containers:
52+
- name: elasticsearch
53+
resources:
54+
requests:
55+
memory: 1Gi
56+
cpu: 500m
57+
limits:
58+
memory: 1Gi
59+
cpu: 500m
60+
initContainers:
61+
- name: max-map-count-check
62+
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"]
63+
resources:
64+
requests:
65+
memory: 16Mi
66+
cpu: 10m
67+
limits:
68+
memory: 16Mi
69+
cpu: 10m
70+
---
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
---
2+
apiVersion: kibana.k8s.elastic.co/v1
3+
kind: Kibana
4+
metadata:
5+
name: kibana
6+
spec:
7+
version: 8.7.0
8+
count: 1
9+
elasticsearchRef:
10+
name: elasticsearch
11+
config:
12+
xpack.fleet.agents.elasticsearch.hosts: ["https://elasticsearch-es-http.default.svc:9200"]
13+
xpack.fleet.agents.fleet_server.hosts: ["https://fleet-server-agent-http.default.svc:8220"]
14+
xpack.fleet.packages:
15+
- name: system
16+
version: latest
17+
- name: elastic_agent
18+
version: latest
19+
- name: fleet_server
20+
version: latest
21+
- name: kubernetes
22+
version: latest
23+
xpack.fleet.agentPolicies:
24+
- name: Fleet Server on ECK policy
25+
id: eck-fleet-server
26+
namespace: default
27+
monitoring_enabled:
28+
- logs
29+
- metrics
30+
unenroll_timeout: 900
31+
package_policies:
32+
- name: fleet_server-1
33+
id: fleet_server-1
34+
package:
35+
name: fleet_server
36+
- name: Elastic Agent on ECK policy
37+
id: eck-agent
38+
namespace: default
39+
monitoring_enabled:
40+
- logs
41+
- metrics
42+
unenroll_timeout: 900
43+
package_policies:
44+
- package:
45+
name: system
46+
name: system-1
47+
- package:
48+
name: kubernetes
49+
name: kubernetes-1
50+
podTemplate:
51+
spec:
52+
nodeSelector:
53+
cloud.google.com/compute-class: "Balanced"
54+
containers:
55+
- name: kibana
56+
resources:
57+
requests:
58+
memory: 1Gi
59+
cpu: 200m
60+
limits:
61+
memory: 1Gi
62+
cpu: 200m
63+
---
64+
apiVersion: agent.k8s.elastic.co/v1alpha1
65+
kind: Agent
66+
metadata:
67+
name: fleet-server
68+
spec:
69+
version: 8.7.0
70+
kibanaRef:
71+
name: kibana
72+
elasticsearchRefs:
73+
- name: elasticsearch
74+
mode: fleet
75+
fleetServerEnabled: true
76+
policyID: eck-fleet-server
77+
deployment:
78+
replicas: 1
79+
podTemplate:
80+
spec:
81+
nodeSelector:
82+
cloud.google.com/compute-class: "Balanced"
83+
containers:
84+
- name: agent
85+
resources:
86+
requests:
87+
cpu: 200m
88+
limits:
89+
ephemeral-storage: "10Gi"
90+
volumes:
91+
- name: "agent-data"
92+
ephemeral:
93+
volumeClaimTemplate:
94+
spec:
95+
accessModes: [ "ReadWriteOnce" ]
96+
storageClassName: "standard-rwo"
97+
resources:
98+
requests:
99+
storage: 10Gi
100+
serviceAccountName: fleet-server
101+
automountServiceAccountToken: true
102+
securityContext:
103+
runAsUser: 0
104+
---
105+
apiVersion: agent.k8s.elastic.co/v1alpha1
106+
kind: Agent
107+
metadata:
108+
name: elastic-agent
109+
spec:
110+
version: 8.7.0
111+
kibanaRef:
112+
name: kibana
113+
fleetServerRef:
114+
name: fleet-server
115+
mode: fleet
116+
policyID: eck-agent
117+
daemonSet:
118+
podTemplate:
119+
spec:
120+
nodeSelector:
121+
cloud.google.com/compute-class: "Balanced"
122+
volumes:
123+
- name: "agent-data"
124+
ephemeral:
125+
volumeClaimTemplate:
126+
spec:
127+
accessModes: [ "ReadWriteOnce" ]
128+
storageClassName: "standard-rwo"
129+
resources:
130+
requests:
131+
storage: 10Gi
132+
containers:
133+
- name: agent
134+
resources:
135+
requests:
136+
cpu: 200m
137+
limits:
138+
ephemeral-storage: "10Gi"
139+
serviceAccountName: elastic-agent
140+
automountServiceAccountToken: true
141+
securityContext:
142+
runAsUser: 0
143+
---
144+
apiVersion: rbac.authorization.k8s.io/v1
145+
kind: ClusterRole
146+
metadata:
147+
name: fleet-server
148+
rules:
149+
- apiGroups: [""]
150+
resources:
151+
- pods
152+
- namespaces
153+
- nodes
154+
verbs:
155+
- get
156+
- watch
157+
- list
158+
- apiGroups: ["coordination.k8s.io"]
159+
resources:
160+
- leases
161+
verbs:
162+
- get
163+
- create
164+
- update
165+
---
166+
apiVersion: v1
167+
kind: ServiceAccount
168+
metadata:
169+
name: fleet-server
170+
namespace: default
171+
---
172+
apiVersion: rbac.authorization.k8s.io/v1
173+
kind: ClusterRoleBinding
174+
metadata:
175+
name: fleet-server
176+
subjects:
177+
- kind: ServiceAccount
178+
name: fleet-server
179+
namespace: default
180+
roleRef:
181+
kind: ClusterRole
182+
name: fleet-server
183+
apiGroup: rbac.authorization.k8s.io
184+
---
185+
apiVersion: rbac.authorization.k8s.io/v1
186+
kind: ClusterRole
187+
metadata:
188+
name: elastic-agent
189+
rules:
190+
- apiGroups: [""]
191+
resources:
192+
- pods
193+
- nodes
194+
- namespaces
195+
- events
196+
- services
197+
- configmaps
198+
verbs:
199+
- get
200+
- watch
201+
- list
202+
- apiGroups: ["coordination.k8s.io"]
203+
resources:
204+
- leases
205+
verbs:
206+
- get
207+
- create
208+
- update
209+
- nonResourceURLs:
210+
- "/metrics"
211+
verbs:
212+
- get
213+
- apiGroups: ["extensions"]
214+
resources:
215+
- replicasets
216+
verbs:
217+
- "get"
218+
- "list"
219+
- "watch"
220+
- apiGroups:
221+
- "apps"
222+
resources:
223+
- statefulsets
224+
- deployments
225+
- replicasets
226+
verbs:
227+
- "get"
228+
- "list"
229+
- "watch"
230+
- apiGroups:
231+
- ""
232+
resources:
233+
- nodes/stats
234+
verbs:
235+
- get
236+
- apiGroups:
237+
- "batch"
238+
resources:
239+
- jobs
240+
verbs:
241+
- "get"
242+
- "list"
243+
- "watch"
244+
---
245+
apiVersion: v1
246+
kind: ServiceAccount
247+
metadata:
248+
name: elastic-agent
249+
namespace: default
250+
---
251+
apiVersion: rbac.authorization.k8s.io/v1
252+
kind: ClusterRoleBinding
253+
metadata:
254+
name: elastic-agent
255+
subjects:
256+
- kind: ServiceAccount
257+
name: elastic-agent
258+
namespace: default
259+
roleRef:
260+
kind: ClusterRole
261+
name: elastic-agent
262+
apiGroup: rbac.authorization.k8s.io
263+
---

0 commit comments

Comments
 (0)