Allow projected volumes for elasticsearch, logstash and metricbeat#496
Allow projected volumes for elasticsearch, logstash and metricbeat#496krichter722 wants to merge 1 commit intoelastic:masterfrom
Conversation
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
bab6cab to
510f33b
Compare
f1519d9 to
69f69a4
Compare
eed0f62 to
52c3449
Compare
52c3449 to
d4402df
Compare
Allow specification of PodSecurityPolicy in metricbeat/values.yml Signed-off-by: Karl-Philipp Richter <krichter@posteo.de>
d4402df to
c68b80e
Compare
|
Hi @krichter722, thank you for this PR. |
|
Thanks for the details. Do you have any source mentioning that projected volumes are required on GKE 1.16? I didn't find any and would be greatly interested by that. |
|
@jmlrt No, they seem to be the default if nothing else is specified. Maybe the problem that the deployment on a cluster with pod security policy enabled fails with default values can be solved differently. |
|
FYI, we just merged #635 which is adding tests on K8S 1.16. |
|
jenkins test this please |
@jmlrt There's no rush. I you have a plan for 1.16 and maybe even 1.17 tests, you should prioritize them and save the manual tests. |
|
I did some tests with GKE 1.16 and PSP and was able to deploy Elasticsearch and Logstash charts without projected volumes. Can you post your other values? |
jmlrt
left a comment
There was a problem hiding this comment.
Metricbeat ClusterRole needs a rule for podsecuritypolicies resource:
{{- if .Values.managedServiceAccount }}
{{- $fullName := include "metricbeat.fullname" . -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ template "metricbeat.serviceAccount" . }}-cluster-role
labels:
app: "{{ template "metricbeat.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
rules:
- apiGroups:
- extensions
resources:
- podsecuritypolicies
resourceNames:
{{- if eq .Values.podSecurityPolicy.name "" }}
- {{ $fullName | quote }}
{{- else }}
- {{ .Values.podSecurityPolicy.name | quote }}
{{- end }}
verbs:
- use
{{ toYaml .Values.clusterRoleRules | nindent 2 -}}
{{- end -}}| rule: RunAsAny | ||
| supplementalGroups: | ||
| rule: RunAsAny | ||
| volumes: |
There was a problem hiding this comment.
hostPath is also required for Metricbeat daemonset
|
During my tests |
| - secret | ||
| - configMap | ||
| - persistentVolumeClaim | ||
| - projected |
There was a problem hiding this comment.
While projected doesn't seem required in my tests with GKE 1.16 it is mentionned as part of the recommended minimum set of allowed volumes for new PSPs in https://kubernetes.io/docs/concepts/policy/pod-security-policy/#volumes-and-file-systems.
Note that we could also add downwardAPI and emptyDir which are also part of the recommendations (same for the other charts)
jmlrt
left a comment
There was a problem hiding this comment.
Also can you please add podSecurityPolicy value description to the README doc and some python tests for the pod security policy like in
helm-charts/logstash/tests/logstash_test.py
Lines 583 to 672 in 4f40f6d
|
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. To track this PR (even if closed), please open a corresponding issue if one does not already exist. |
|
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. To track this PR (even if closed), please open a corresponding issue if one does not already exist. |
|
closing as stale |
Projected volumes are the default volume type on Google Kubernetes Engine (GKE) with cluster >= 1.16. This PR allows to use them out-of-the-box more easily if pod security policy is enabled. This is only relevant for clusters with pod security policy enabled. By default >= 1.16 clusters should work with this PR.
Furthermore, it adds a missing pod security policy for metricbeat for this case.
${CHART}/tests/*.py${CHART}/examples/*/test/goss.yaml