diff --git a/charts/fleet-agent/templates/deployment.yaml b/charts/fleet-agent/templates/deployment.yaml index 2a3409edb3..a9033b2892 100644 --- a/charts/fleet-agent/templates/deployment.yaml +++ b/charts/fleet-agent/templates/deployment.yaml @@ -59,6 +59,9 @@ spec: drop: - ALL {{- end }} + volumeMounts: + - mountPath: /.kube + name: kube - env: - name: NAMESPACE valueFrom: @@ -82,6 +85,9 @@ spec: drop: - ALL {{- end }} + volumes: + - name: kube + emptyDir: {} serviceAccountName: fleet-agent nodeSelector: {{ include "linux-node-selector" . | nindent 8 }} {{- if .Values.fleetAgent.nodeSelector }} diff --git a/internal/cmd/controller/agentmanagement/agent/manifest.go b/internal/cmd/controller/agentmanagement/agent/manifest.go index caf98a3940..8de1c097ad 100644 --- a/internal/cmd/controller/agentmanagement/agent/manifest.go +++ b/internal/cmd/controller/agentmanagement/agent/manifest.go @@ -213,6 +213,12 @@ func agentApp(namespace string, agentScope string, opts ManifestOptions) *appsv1 Command: []string{ "fleetagent", }, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "kube", + MountPath: "/.kube", + }, + }, }, { Name: name + "-clusterstatus", @@ -235,6 +241,14 @@ func agentApp(namespace string, agentScope string, opts ManifestOptions) *appsv1 }, }, }, + Volumes: []corev1.Volume{ + { + Name: "kube", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, + }, NodeSelector: map[string]string{"kubernetes.io/os": "linux"}, Affinity: &corev1.Affinity{ NodeAffinity: &corev1.NodeAffinity{