Debug toolbox in a sidecar container

This commit is contained in:
Laszlo Fogas
2021-02-10 12:22:01 +01:00
parent 7217148cf6
commit 298624c707
11 changed files with 102 additions and 43 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.11.0
version: 0.12.0
+16 -4
View File
@@ -28,17 +28,17 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Release.Name }}
securityContext:
securityContext: &securityContext
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
imagePullPolicy: {{ .Values.image.pullPolicy }} &imagePullPolicy
{{- if .Values.command }}
command:
- {{ .Values.shell }}
- -c
- {{ .Values.command | quote }}
{{- end }}
envFrom:
envFrom: &envFrom
{{- if .Values.vars }}
- configMapRef:
name: {{ .Release.Name }}
@@ -66,7 +66,7 @@ spec:
successThreshold: 1
timeoutSeconds: 10
{{- end }}
volumeMounts:
volumeMounts: &volumeMounts
{{- range .Values.volumes }}
- name: {{ .name }}
mountPath: {{ .path }}
@@ -78,6 +78,18 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.debugSidecarEnabled }}
- name: {{ .Release.Name }}-debug
securityContext: *securityContext
image: {{ .Values.debugSidecar.image }}
imagePullPolicy: *imagePullPolicy
command:
- {{ .Values.debugSidecar.shell }}
- -c
- {{ .Values.debugSidecar.command | quote }}
envFrom: *envFrom
volumeMounts: *volumeMounts
{{- end }}
volumes:
{{- range .Values.volumes }}
- name: {{ .name }}
@@ -0,0 +1,12 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should add a debug sidecar
set:
debugSidecarEnabled: true
asserts:
- equal:
path: spec.template.spec.containers[1].image
value: debian:stable-slim
+6
View File
@@ -38,3 +38,9 @@ secret:
enabled: false
shell: "/bin/sh"
debugSidecarEnabled: false
debugSidecar:
image: debian:stable-slim
shell: "/bin/bash"
command: "while true; do sleep 30; done;"
Binary file not shown.
+38 -28
View File
@@ -2,17 +2,17 @@ apiVersion: v1
entries:
cron-job:
- apiVersion: v2
created: "2021-02-09T15:35:30.813954429+01:00"
created: "2021-02-10T12:21:47.310328608+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 1a40a1990387a705ca29c7f55d8e9e7bb43b7a921e38410cdcfbdd5d790e61e3
digest: 43caf6c8c2b9eeaa79beabcb1e1f6fed5fea5ae36b5ef461fd90662a69c0647c
name: cron-job
type: application
urls:
- https://chart.onechart.dev/cron-job-0.1.2.tgz
version: 0.1.2
- apiVersion: v2
created: "2021-02-09T15:35:30.81369606+01:00"
created: "2021-02-10T12:21:47.310006524+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: afab9ba533a4686827b54b0dad64f5bbf76f7fbc075e35fb1034689db9ab9dda
@@ -22,7 +22,7 @@ entries:
- https://chart.onechart.dev/cron-job-0.1.1.tgz
version: 0.1.1
- apiVersion: v2
created: "2021-02-09T15:35:30.813318713+01:00"
created: "2021-02-10T12:21:47.309742051+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 01f9fa40c1c4085d7688474ab00c9e9d21bd1d0793db6b75f2edda0e18456282
@@ -33,16 +33,16 @@ entries:
version: 0.1.0
namespaces:
- apiVersion: v2
created: "2021-02-09T15:35:30.814764365+01:00"
created: "2021-02-10T12:21:47.311508572+01:00"
description: Chart to create namespaces and their defaults
digest: 9a24f57d2f7a0626e8d4eac2194f55efb33aa96be3ce0ce0043f290f7246f059
digest: 56b5ac5ddcc0a68e011c51fffa51d6e5c41beeffeb07650caa45a5330017dc90
name: namespaces
type: application
urls:
- https://chart.onechart.dev/namespaces-0.2.0.tgz
version: 0.2.0
- apiVersion: v2
created: "2021-02-09T15:35:30.814385206+01:00"
created: "2021-02-10T12:21:47.310807572+01:00"
description: Chart to create namespaces and their defaults
digest: 88b06d78a9d1bda6f2ee15b1fad7f25399ac25c2320fb9a8dfa1a4fd14afdf6e
name: namespaces
@@ -52,7 +52,17 @@ entries:
version: 0.1.0
onechart:
- apiVersion: v2
created: "2021-02-09T15:35:30.81747555+01:00"
created: "2021-02-10T12:21:47.313581858+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: f38a6f2fbf5c847b00a9140ecd004e0bf667d859aa83d8dac4a2d0eecd1a361f
name: onechart
type: application
urls:
- https://chart.onechart.dev/onechart-0.12.0.tgz
version: 0.12.0
- apiVersion: v2
created: "2021-02-10T12:21:47.313116481+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 75c16f84b5e99aad5aa7203f5c1ce2a9589d85b89afec4e161a2e0344a522c17
@@ -62,7 +72,7 @@ entries:
- https://chart.onechart.dev/onechart-0.11.0.tgz
version: 0.11.0
- apiVersion: v2
created: "2021-02-09T15:35:30.816474399+01:00"
created: "2021-02-10T12:21:47.312709428+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 40f1166e858d35cb237debd1390187884641b0e8c29a80aaa195b66b0ee73516
@@ -72,7 +82,7 @@ entries:
- https://chart.onechart.dev/onechart-0.10.0.tgz
version: 0.10.0
- apiVersion: v2
created: "2021-02-09T15:35:30.823531452+01:00"
created: "2021-02-10T12:21:47.318942045+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: cb42b08b463b401f6718bba7c171ee55c173021c5101ea1b3068ef3899a6e164
@@ -82,7 +92,7 @@ entries:
- https://chart.onechart.dev/onechart-0.9.0.tgz
version: 0.9.0
- apiVersion: v2
created: "2021-02-09T15:35:30.822997051+01:00"
created: "2021-02-10T12:21:47.318543838+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: ce046d209a9e8fa07766712492cc896451473fafca129dbc9c675107d0e39c52
@@ -92,7 +102,7 @@ entries:
- https://chart.onechart.dev/onechart-0.8.2.tgz
version: 0.8.2
- apiVersion: v2
created: "2021-02-09T15:35:30.822550981+01:00"
created: "2021-02-10T12:21:47.318184404+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 422d7e6ea1bed530d4cd5e23417b229772a6fe2e835828ca282a3e6c9b646b2b
@@ -102,7 +112,7 @@ entries:
- https://chart.onechart.dev/onechart-0.8.1.tgz
version: 0.8.1
- apiVersion: v2
created: "2021-02-09T15:35:30.822095557+01:00"
created: "2021-02-10T12:21:47.317696208+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 8001bd02fc90ad66da7941c136ee8d0e665ea90b6e1ac27d82b048f2b12b3964
@@ -112,7 +122,7 @@ entries:
- https://chart.onechart.dev/onechart-0.8.0.tgz
version: 0.8.0
- apiVersion: v2
created: "2021-02-09T15:35:30.821640585+01:00"
created: "2021-02-10T12:21:47.316770481+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: d1454b430eb7131d0d450f7c0a8a6698278893c61e03d48649a8112dfcf42b72
@@ -122,7 +132,7 @@ entries:
- https://chart.onechart.dev/onechart-0.7.1.tgz
version: 0.7.1
- apiVersion: v2
created: "2021-02-09T15:35:30.821183919+01:00"
created: "2021-02-10T12:21:47.316372182+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 4bf90835f287917671ec40b5b395da9332cf18e70f248d250f8d5a72360dcb4e
@@ -132,7 +142,7 @@ entries:
- https://chart.onechart.dev/onechart-0.7.0.tgz
version: 0.7.0
- apiVersion: v2
created: "2021-02-09T15:35:30.820753131+01:00"
created: "2021-02-10T12:21:47.316014057+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 0cade489fc74a040f5e7f71d01c6fa00d3f68b4752a4d8234ccf2c1504b4c0a1
@@ -142,7 +152,7 @@ entries:
- https://chart.onechart.dev/onechart-0.6.1.tgz
version: 0.6.1
- apiVersion: v2
created: "2021-02-09T15:35:30.820365382+01:00"
created: "2021-02-10T12:21:47.315706288+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: d607820a7e104eaaa88c153c1f2f7f409ef4c612ad747caeb3a671cf3fce03d4
@@ -152,7 +162,7 @@ entries:
- https://chart.onechart.dev/onechart-0.6.0.tgz
version: 0.6.0
- apiVersion: v2
created: "2021-02-09T15:35:30.819988445+01:00"
created: "2021-02-10T12:21:47.315391168+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: ddf7cf87402095d62855898744b805115fdf86c4b295e0a4def0c50408fd9138
@@ -162,7 +172,7 @@ entries:
- https://chart.onechart.dev/onechart-0.5.1.tgz
version: 0.5.1
- apiVersion: v2
created: "2021-02-09T15:35:30.819614118+01:00"
created: "2021-02-10T12:21:47.315111011+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: adf3c2cf3a27e58ec75620599e0e1c2031a7410a061a590317beeff6d8a9ad69
@@ -172,7 +182,7 @@ entries:
- https://chart.onechart.dev/onechart-0.5.0.tgz
version: 0.5.0
- apiVersion: v2
created: "2021-02-09T15:35:30.81925453+01:00"
created: "2021-02-10T12:21:47.314826636+01:00"
description: One chart to rule them all. A generic Helm chart for your application
deployments. Because no-one can remember the Kubernetes yaml syntax.
digest: 8dab33263c4e632aeb4656c666871440b589497b70e76a1d6c3a5e3db1a30bba
@@ -182,7 +192,7 @@ entries:
- https://chart.onechart.dev/onechart-0.4.0.tgz
version: 0.4.0
- apiVersion: v2
created: "2021-02-09T15:35:30.818911189+01:00"
created: "2021-02-10T12:21:47.314553313+01:00"
description: A generic Helm chart for your application deployments
digest: fbaf6139e0ef8ad9a87cc1e41a97c7d25fdcf7ea17fa6364952f1a851a87480a
name: onechart
@@ -191,7 +201,7 @@ entries:
- https://chart.onechart.dev/onechart-0.3.2.tgz
version: 0.3.2
- apiVersion: v2
created: "2021-02-09T15:35:30.818583311+01:00"
created: "2021-02-10T12:21:47.314297793+01:00"
description: A generic Helm chart for your application deployments
digest: bd6f5b1865ab9b05fc6925c163ab8045235bd2723dba31f09d5083d24322d1f8
name: onechart
@@ -200,7 +210,7 @@ entries:
- https://chart.onechart.dev/onechart-0.3.1.tgz
version: 0.3.1
- apiVersion: v2
created: "2021-02-09T15:35:30.818248365+01:00"
created: "2021-02-10T12:21:47.314068173+01:00"
description: A generic Helm chart for your application deployments
digest: c79cef21eceab948144a289298cdf1e20e77a0782a883d7d65f9e709ccbbc271
name: onechart
@@ -209,7 +219,7 @@ entries:
- https://chart.onechart.dev/onechart-0.3.0.tgz
version: 0.3.0
- apiVersion: v2
created: "2021-02-09T15:35:30.817877576+01:00"
created: "2021-02-10T12:21:47.313833936+01:00"
description: A generic Helm chart for your application deployments
digest: dd814ac5d08d5e6163a1b769df6803f5cb0f09d906045086dfcc5be522bb1ec3
name: onechart
@@ -218,7 +228,7 @@ entries:
- https://chart.onechart.dev/onechart-0.2.0.tgz
version: 0.2.0
- apiVersion: v2
created: "2021-02-09T15:35:30.815892537+01:00"
created: "2021-02-10T12:21:47.312281182+01:00"
description: A generic Helm chart for your application deployments
digest: e46062df8053840cbfbba26c0a66a843a79f15a0b43a145ed019327513bd5098
name: onechart
@@ -227,7 +237,7 @@ entries:
- https://chart.onechart.dev/onechart-0.1.2.tgz
version: 0.1.2
- apiVersion: v2
created: "2021-02-09T15:35:30.815546595+01:00"
created: "2021-02-10T12:21:47.312037018+01:00"
description: A generic Helm chart for your application deployments
digest: a7bbc8b7dcc008e89156cd1830282b7d39c0592e82ccdcefb77a25a42eca2a3d
name: onechart
@@ -236,7 +246,7 @@ entries:
- https://chart.onechart.dev/onechart-0.1.1.tgz
version: 0.1.1
- apiVersion: v2
created: "2021-02-09T15:35:30.81518998+01:00"
created: "2021-02-10T12:21:47.31178472+01:00"
description: A generic Helm chart for your application deployments
digest: 1ed8c0645abdae6c950526e9c5410dc056847a11700dc7def5f1c55eb7de0cd4
name: onechart
@@ -244,4 +254,4 @@ entries:
urls:
- https://chart.onechart.dev/onechart-0.1.0.tgz
version: 0.1.0
generated: "2021-02-09T15:35:30.812854407+01:00"
generated: "2021-02-10T12:21:47.309359367+01:00"
Binary file not shown.
Binary file not shown.
+7 -10
View File
@@ -1,10 +1,7 @@
sealedFileSecrets:
- name: google-account-key
path: /google-account-key
filesToMount:
- name: key
# sourcePath: README.md
source: |-
{
"what": "this is a fixture"
}
debugSidecarEnabled: true
volumes:
- name: data
path: /data
size: 1Gi
storageClass: local-path
+21
View File
@@ -0,0 +1,21 @@
This page shows how you can add a sidecar container with debug tools installed.
The debug sidecar container will have access to the same resources as your app container, so you don't have to inflate your app container with debug tools.
The following example adds a default debug container (a debian image) to your deployment, and you can verify that this container will have access to the defined volume.
```yaml
debugSidecarEnabled: true
volumes:
- name: data
path: /data
size: 1Gi
storageClass: local-path
```
Check the Kubernetes manifest:
```bash
helm template my-release onechart/onechart -f values.yaml
```
+1
View File
@@ -140,3 +140,4 @@ nav:
- Cron job: examples/cron-job.md
- Feature branch deploys: examples/feature-branch-deploys.md
- Prometheus monitoring rules: examples/prometheus-monitoring-rules.md
- Debug toolbox in a sidecar: examples/debugSidecar.md