Unverified Commit 8c7c7f8c by GC Committed by GitHub

added psp to the es server and fixed vm max_map_count setting (#16)

parent 510b197f
apiVersion: v1 apiVersion: v1
description: EFK(Elasticsearch + FluentBit + Kibana) description: EFK(Elasticsearch + FluentBit + Kibana)
name: efk name: efk
version: 0.1.1 version: 0.1.2
icon: https://image.slidesharecdn.com/challengesinamicroservicesage-170505115849/95/challenges-in-a-microservices-age-monitoring-logging-and-tracing-on-red-hat-openshift-68-638.jpg icon: https://image.slidesharecdn.com/challengesinamicroservicesage-170505115849/95/challenges-in-a-microservices-age-monitoring-logging-and-tracing-on-red-hat-openshift-68-638.jpg
sources: sources:
- https://www.elastic.co/products/elasticsearch - https://www.elastic.co/products/elasticsearch
......
...@@ -25,4 +25,12 @@ rules: ...@@ -25,4 +25,12 @@ rules:
- statefulsets/status - statefulsets/status
verbs: verbs:
- get - get
- apiGroups:
- extensions
resources:
- podsecuritypolicies
verbs:
- use
resourceNames:
- {{ template "elasticsearch.fullname" . }}
{{- end -}} {{- end -}}
{{- if .Values.pspEnable }}
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
labels:
app: {{ template "elasticsearch.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
name: {{ template "elasticsearch.fullname" . }}
annotations:
security.alpha.kubernetes.io/sysctls: 'vm.max_map_count'
spec:
privileged: false
# Required to prevent escalations to root.
# allowPrivilegeEscalation: false
# This is redundant with non-root + disallow privilege escalation,
# but we can provide it for defense in depth.
#requiredDropCapabilities:
# - ALL
# Allow core volume types.
volumes:
- '*'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
# Permits the container to run with root privileges as well.
rule: 'RunAsAny'
seLinux:
# This policy assumes the nodes are using AppArmor rather than SELinux.
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 0
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 0
max: 65535
readOnlyRootFilesystem: false
{{- end }}
...@@ -23,9 +23,11 @@ spec: ...@@ -23,9 +23,11 @@ spec:
{{- end }} {{- end }}
spec: spec:
serviceAccountName: {{ template "elasticsearch.fullname" . }} serviceAccountName: {{ template "elasticsearch.fullname" . }}
{{- if .Values.securityContextEnable }}
securityContext: securityContext:
runAsUser: 1000 runAsUser: 1000
fsGroup: 1000 fsGroup: 1000
{{- end }}
{{- if eq .Values.master.antiAffinity "hard" }} {{- if eq .Values.master.antiAffinity "hard" }}
affinity: affinity:
podAntiAffinity: podAntiAffinity:
...@@ -71,8 +73,6 @@ spec: ...@@ -71,8 +73,6 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: discovery.zen.ping.unicast.hosts
value: {{ template "elasticsearch.fullname" . }}
# node roles, default to all true # node roles, default to all true
# - name: NODE_MASTER # - name: NODE_MASTER
# value: "true" # value: "true"
...@@ -108,10 +108,10 @@ spec: ...@@ -108,10 +108,10 @@ spec:
{{ end }} {{ end }}
volumeMounts: volumeMounts:
- mountPath: /usr/share/elasticsearch/data - mountPath: /usr/share/elasticsearch/data
name: data name: es-data
volumes: volumes:
{{- if not .Values.master.persistence.enabled }} {{- if not .Values.master.persistence.enabled }}
- name: data - name: es-data
emptyDir: {} emptyDir: {}
{{- else }} {{- else }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
elasticsearch: elasticsearch:
rbac: rbac:
create: true create: true
pspEnable: true
securityContextEnable: true
image: image:
repository: "docker.elastic.co/elasticsearch/elasticsearch-oss" repository: "docker.elastic.co/elasticsearch/elasticsearch-oss"
...@@ -38,9 +40,9 @@ elasticsearch: ...@@ -38,9 +40,9 @@ elasticsearch:
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
## ##
persistence: persistence:
name: data name: es-data
enabled: false enabled: false
## wordpress data Persistent Volume Storage Class ## data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass> ## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning ## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is ## If undefined (the default) or set to null, no storageClassName spec is
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
elasticsearch: elasticsearch:
rbac: rbac:
create: true create: true
pspEnable: true
securityContextEnable: true
image: image:
repository: "docker.elastic.co/elasticsearch/elasticsearch-oss" repository: "docker.elastic.co/elasticsearch/elasticsearch-oss"
...@@ -38,7 +40,7 @@ elasticsearch: ...@@ -38,7 +40,7 @@ elasticsearch:
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
## ##
persistence: persistence:
name: data name: es-data
enabled: false enabled: false
## wordpress data Persistent Volume Storage Class ## wordpress data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass> ## If defined, storageClassName: <storageClass>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment