### Helm install with --set Source: https://helm.sh/docs/topics/charts Command to install a chart and set a value that satisfies the schema. ```bash helm install --set port=443 ``` -------------------------------- ### Install Chart from Repository URL Source: https://helm.sh/docs/helm/helm_install Installs a chart by specifying the chart repository URL and the chart name. ```bash helm install --repo https://example.com/charts/ mynginx nginx ``` -------------------------------- ### Install Chart from Unpacked Directory Source: https://helm.sh/docs/helm/helm_install Installs a chart from an unpacked chart directory on the local filesystem. ```bash helm install mynginx ./nginx ``` -------------------------------- ### Install a Helm Plugin Source: https://helm.sh/docs/helm/helm_plugin_install Use this command to install a Helm plugin from a specified URL or local path. Options can be used to control verification and security during the download and installation process. ```bash helm plugin install [options] [flags] ``` -------------------------------- ### Install Chart by Reference Source: https://helm.sh/docs/helm/helm_install Installs a chart using its reference name, which Helm resolves from configured chart repositories. ```bash helm install mymaria example/mariadb ``` -------------------------------- ### Install Chart from Packaged File Source: https://helm.sh/docs/helm/helm_install Installs a chart directly from a packaged chart archive file (.tgz). ```bash helm install mynginx ./nginx-1.2.3.tgz ``` -------------------------------- ### Helm Install Command Syntax Source: https://helm.sh/docs/helm/helm_install Basic syntax for the 'helm install' command, specifying the release name and the chart to install. ```bash helm install [NAME] [CHART] [flags] ``` -------------------------------- ### Example NOTES.txt Content Source: https://helm.sh/docs/chart_template_guide/notes_files This is a basic example of a NOTES.txt file. It uses Go template syntax to dynamically insert chart and release information. ```go-template Thank you for installing {{ .Chart.Name }}. Your release is named {{ .Release.Name }}. To learn more about the release, try: $ helm status {{ .Release.Name }} $ helm get all {{ .Release.Name }} ``` -------------------------------- ### Install Chart from OCI Registry Source: https://helm.sh/docs/helm/helm_install Installs a chart from an OCI-compliant registry, specifying the chart reference and optionally a version. ```bash helm install mynginx --version 1.2.3 oci://example.com/charts/nginx ``` -------------------------------- ### Install Chart with Set-Json Flag (Array) Source: https://helm.sh/docs/helm/helm_install Installs a chart and sets a JSON array value using the --set-json flag. ```bash helm install --set-json 'master.sidecars=[{"name":"sidecar","image":"myImage","imagePullPolicy":"Always","ports":[{"name":"portname","containerPort":1234}]}]' myredis ./redis ``` -------------------------------- ### Install Chart with Values File Source: https://helm.sh/docs/helm/helm_install Installs a chart by specifying a values file to override default chart values. ```bash helm install -f myvalues.yaml myredis ./redis ``` -------------------------------- ### Install Chart from Absolute URL Source: https://helm.sh/docs/helm/helm_install Installs a chart by providing its absolute URL, typically pointing to a chart archive. ```bash helm install mynginx https://example.com/charts/nginx-1.2.3.tgz ``` -------------------------------- ### Install Chart by Digest with Helm Source: https://helm.sh/docs/overview Install a chart using its OCI digest for enhanced supply chain security. Charts with non-matching digests will not be installed. ```bash helm install myapp oci://registry.example.com/charts/app@sha256:abc123... ``` -------------------------------- ### Helm Install Command Source: https://helm.sh/docs/chart_template_guide/getting_started Installs a Helm chart named 'clunky-serval' from the local directory './mychart'. This command shows the output after a successful installation, including the generated resource name. ```bash $ helm install clunky-serval ./mychart NAME: clunky-serval LAST DEPLOYED: Tue Nov 1 17:45:37 2016 NAMESPACE: default STATUS: DEPLOYED REVISION: 1 TEST SUITE: None ``` -------------------------------- ### Example .helmignore File Source: https://helm.sh/docs/chart_template_guide/helm_ignore_file This example demonstrates various patterns that can be used in a .helmignore file to exclude files and directories. Place this file in your chart's root directory. ```helmignore # comment # Match any file or path named .helmignore .helmignore # Match any file or path named .git .git # Match any text file *.txt # Match only directories named mydir mydir/ # Match only text files in the top-level directory /*.txt # Match only the file foo.txt in the top-level directory /foo.txt # Match any file named ab.txt, ac.txt, or ad.txt a[b-d].txt # Match any file under subdir matching draft* */draft* # Match draft files two levels deep (e.g., foo/bar/draft123) */*/draft* draft? ``` -------------------------------- ### Basic `with` block example Source: https://helm.sh/docs/chart_template_guide/control_structures Demonstrates the basic syntax of the `with` control structure to set a new scope. ```go-template {{ with PIPELINE }} # restricted scope {{ end }} ``` -------------------------------- ### Install or Upgrade a Helm Release Source: https://helm.sh/docs/howto/charts_tips_and_tricks Use the `helm upgrade --install` command to either install a new release or upgrade an existing one. This command checks if a release already exists and performs the appropriate action. ```bash helm upgrade --install --values ``` -------------------------------- ### Valid values.yaml example Source: https://helm.sh/docs/topics/charts An example `values.yaml` file that conforms to the defined schema. ```yaml name: frontend protocol: https port: 443 ``` -------------------------------- ### Rendered ConfigMap Example (Repeat) Source: https://helm.sh/docs/chart_template_guide/functions_and_pipelines This is an example of a rendered ConfigMap, showing the output after applying the 'repeat' and 'quote' functions to the 'drink' value. ```yaml # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: melting-porcup-configmap data: myvalue: "Hello World" drink: "coffeecoffeecoffeecoffeecoffee" food: "PIZZA" ``` -------------------------------- ### Install Chart with Set-File Flag Source: https://helm.sh/docs/helm/helm_install Installs a chart and sets a value from the content of a specified file, useful for long or dynamically generated values. ```bash helm install --set-file my_script=dothings.sh myredis ./redis ``` -------------------------------- ### Include, Lowercase, and Quote Template Output in Helm Source: https://helm.sh/docs/howto/charts_tips_and_tricks This example demonstrates chaining template functions: 'include' to get template content, 'lower' to convert it to lowercase, and 'quote' to wrap it in double quotes. ```go-template value: {{ include "mytpl" . | lower | quote }} ``` -------------------------------- ### Install Chart with Multiple Set-Json Flags (Array) Source: https://helm.sh/docs/helm/helm_install Installs a chart and updates a JSON array value through multiple --set-json flags, with the last update taking precedence. ```bash helm install --set-json='foo=["one", "two", "three"]' --set-json='foo=["four"]' myredis ./redis ``` -------------------------------- ### Install Chart with Multiple Values Files Source: https://helm.sh/docs/helm/helm_install Installs a chart using multiple values files, where the last file specified takes precedence for overriding values. ```bash helm install -f myvalues.yaml -f override.yaml myredis ./redis ``` -------------------------------- ### Default values.yaml Example Source: https://helm.sh/docs/topics/charts This is an example of a default `values.yaml` file for a Helm chart. It defines configuration parameters that can be overridden by users. ```yaml imageRegistry: "quay.io/deis" dockerTag: "latest" pullPolicy: "Always" storage: "s3" ``` -------------------------------- ### Rendered ConfigMap Example (Uppercase) Source: https://helm.sh/docs/chart_template_guide/functions_and_pipelines This is an example of a rendered ConfigMap, showing the output after applying the 'upper' and 'quote' functions to the 'food' value. ```yaml # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: trendsetting-p-configmap data: myvalue: "Hello World" drink: "coffee" food: "PIZZA" ``` -------------------------------- ### Install Chart with Set-Json Flag (Object) Source: https://helm.sh/docs/helm/helm_install Installs a chart and sets a JSON object value by passing the entire object as a string to the --set-json flag. ```bash helm install --set-json '{"master":{"sidecars":[{"name":"sidecar","image":"myImage","imagePullPolicy":"Always","ports":[{"name":"portname","containerPort":1234}]}]}}' myredis ./redis ``` -------------------------------- ### Install a Helm Chart Source: https://helm.sh/docs/chart_template_guide/getting_started Installs a Helm chart from a local directory. This command deploys the resources defined in the chart's templates to your Kubernetes cluster. ```bash $ helm install full-coral ./mychart NAME: full-coral LAST DEPLOYED: Tue Nov 1 17:36:01 2016 NAMESPACE: default STATUS: DEPLOYED REVISION: 1 TEST SUITE: None ``` -------------------------------- ### Install Chart with Multiple Set Flags Source: https://helm.sh/docs/helm/helm_install Installs a chart with multiple --set flags, where the last specified value for a given key takes precedence. ```bash helm install --set foo=bar --set foo=newbar myredis ./redis ``` -------------------------------- ### Example `values.yaml` with drink omitted Source: https://helm.sh/docs/chart_template_guide/functions_and_pipelines This example shows a `values.yaml` file where the `favorite.drink` is commented out or omitted, triggering the `default` function in the template. ```yaml favorite: #drink: coffee food: pizza ``` -------------------------------- ### Install Chart with Set Flag Source: https://helm.sh/docs/helm/helm_install Installs a chart and overrides a specific value using the --set flag for simple string values. ```bash helm install --set name=prod myredis ./redis ``` -------------------------------- ### Install Chart with Set-String Flag Source: https://helm.sh/docs/helm/helm_install Installs a chart and overrides a value, ensuring it is treated as a string, particularly useful for large numbers. ```bash helm install --set-string long_int=1234567890 myredis ./redis ``` -------------------------------- ### Helm Get All Options Source: https://helm.sh/docs/helm/helm_get_all These are specific options for the 'helm get all' command. Use '--revision' to specify a particular release version or '--template' to format the output. ```bash -h, --help help for all --revision int get the named release with revision --template string go template for formatting the output, eg: {{.Release.Name}} ``` -------------------------------- ### Helm Get Manifest Options Source: https://helm.sh/docs/helm/helm_get_manifest Common options available for the `helm get manifest` command, including help and revision selection. ```bash -h, --help help for manifest --revision int get the named release with revision ``` -------------------------------- ### Overriding Values with helm install Source: https://helm.sh/docs/topics/charts Demonstrates how to install a Helm chart and override default values using the `--values` flag with a custom YAML file. ```bash $ helm install --generate-name --values=myvals.yaml wordpress ``` -------------------------------- ### Create a New Helm Chart Source: https://helm.sh/docs/chart_template_guide/getting_started Initializes a new Helm chart with a default set of files and directories. This is the starting point for building a new chart. ```bash $ helm create mychart Creating mychart ``` -------------------------------- ### Test String Prefix Source: https://helm.sh/docs/chart_template_guide/function_list Checks if a string starts with a specified prefix. Returns `true` if it does, `false` otherwise. ```go hasPrefix "cat" "catch" ``` -------------------------------- ### Helm install dry-run output with default values Source: https://helm.sh/docs/chart_template_guide/values_files Shows the computed values and the resulting manifest when a chart is installed with default `values.yaml` settings. This output helps verify template rendering. ```text $ helm install geared-marsupi ./mychart --dry-run=client --debug install.go:158: [debug] Original chart version: "" install.go:175: [debug] CHART PATH: /home/bagratte/src/playground/mychart NAME: geared-marsupi LAST DEPLOYED: Wed Feb 19 23:21:13 2020 NAMESPACE: default STATUS: pending-install REVISION: 1 TEST SUITE: None USER-SUPPLIED VALUES: {} COMPUTED VALUES: favoriteDrink: coffee HOOKS: MANIFEST: --- # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: geared-marsupi-configmap data: myvalue: "Hello World" drink: coffee ``` -------------------------------- ### Install Chart with Multiple Set-Json Flags (Object Modification) Source: https://helm.sh/docs/helm/helm_install Installs a chart and modifies a JSON object value using multiple --set-json flags, demonstrating nested value updates. ```bash helm install --set-json='foo={"key1":"value1","key2":"value2"}' --set-json='foo.key2="bar"' myredis ./redis ``` -------------------------------- ### YAML Anchors Example Source: https://helm.sh/docs/chart_template_guide/yaml_techniques Demonstrates the use of YAML anchors to define and reference values. The `&favoriteCoffee` defines a reference, and `*favoriteCoffee` uses it. ```yaml coffee: "yes, please" favorite: &favoriteCoffee "Cappuccino" coffees: - Latte - *favoriteCoffee - Espresso ``` -------------------------------- ### Hyphen Range Comparison (Basic) Source: https://helm.sh/docs/chart_template_guide/function_list Use hyphen ranges for concise version range specifications. This example matches versions from `1.2` up to and including `1.4.5`. ```go-template 1.2 - 1.4.5 ``` -------------------------------- ### Create Chart with Starter Pack Source: https://helm.sh/docs/topics/charts Use the `helm create` command with the `--starter` option or its alias `-p` to specify a starter chart. This can be a named starter or an absolute path to a starter chart directory. ```bash helm create my-chart --starter starter-name ``` ```bash helm create my-chart -p starter-name ``` ```bash helm create my-chart -p /absolute/path/to/starter-name ``` -------------------------------- ### Get Kind of a String Source: https://helm.sh/docs/chart_template_guide/function_list Use `kindOf` to determine the Go kind of a given value. This example shows how to get the kind of a string literal. ```go-template kindOf "hello" ``` -------------------------------- ### Helm Dry Run Install Command Source: https://helm.sh/docs/chart_template_guide/getting_started Tests Helm chart template rendering without actually installing the chart. Use this command to preview the generated Kubernetes manifests, including dynamic values like the release name. ```bash $ helm install --debug --dry-run goodly-guppy ./mychart install.go:149: [debug] Original chart version: "" install.go:166: [debug] CHART PATH: /Users/ninja/mychart NAME: goodly-guppy LAST DEPLOYED: Thu Dec 26 17:24:13 2019 NAMESPACE: default STATUS: pending-install REVISION: 1 TEST SUITE: None USER-SUPPLIED VALUES: {} COMPUTED VALUES: affinity: {} fullnameOverride: "" image: pullPolicy: IfNotPresent repository: nginx imagePullSecrets: [] ingress: annotations: {} enabled: false hosts: - host: chart-example.local paths: [] tls: [] nameOverride: "" nodeSelector: {} podSecurityContext: {} replicaCount: 1 resources: {} securityContext: {} service: port: 80 type: ClusterIP serviceAccount: create: true name: null tolerations: [] Hooks: MANIFEST: --- # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: goodly-guppy-configmap data: myvalue: "Hello World" ``` -------------------------------- ### Helm Get Notes Command Synopsis Source: https://helm.sh/docs/helm/helm_get_notes This is the basic syntax for using the 'helm get notes' command to fetch notes for a release. Replace RELEASE_NAME with the actual name of your Helm release. ```bash helm get notes RELEASE_NAME [flags] ``` -------------------------------- ### TOML Configuration Files Source: https://helm.sh/docs/chart_template_guide/accessing_files These TOML files are examples of external configuration data that can be included in a Helm chart. ```toml message = "Hello from config 1" ``` ```toml message = "This is config 2" ``` ```toml message = "Goodbye from config 3" ``` -------------------------------- ### Helm Get All Synopsis Source: https://helm.sh/docs/helm/helm_get_all This is the basic command structure for retrieving all information about a Helm release. Replace RELEASE_NAME with the actual name of your release. ```bash helm get all RELEASE_NAME [flags] ``` -------------------------------- ### Helm Template Comment Example Source: https://helm.sh/docs/chart_best_practices/templates This snippet demonstrates a Helm template comment, enclosed within {{- /* */ -}}. ```go-html-template {{- /* This is a comment. */}} type: frobnitz ``` -------------------------------- ### Example values.schema.json Source: https://helm.sh/docs/topics/charts Defines the structure and types for chart values using JSON Schema. ```json { "$schema": "https://json-schema.org/draft-07/schema#", "properties": { "image": { "description": "Container Image", "properties": { "repo": { "type": "string" }, "tag": { "type": "string" } }, "type": "object" }, "name": { "description": "Service name", "type": "string" }, "port": { "description": "Port", "minimum": 0, "type": "integer" }, "protocol": { "type": "string" } }, "required": [ "protocol", "port" ], "title": "Values", "type": "object" } ``` -------------------------------- ### Helm install with --skip-schema-validation Source: https://helm.sh/docs/topics/charts Command to disable schema validation during chart installation. ```bash helm install --skip-schema-validation ``` -------------------------------- ### Basic ConfigMap with Quote Function Source: https://helm.sh/docs/chart_template_guide/functions_and_pipelines This example demonstrates a basic ConfigMap template using the 'quote' function to ensure string values are properly quoted. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | quote }} food: {{ .Values.favorite.food | quote }} ``` -------------------------------- ### Package Helm Plugin with Options Source: https://helm.sh/docs/helm/helm_plugin_package Demonstrates using options for the 'helm plugin package' command, such as specifying the destination directory and disabling signing. ```bash helm plugin package --destination /path/to/plugins --sign=false ``` -------------------------------- ### Wildcard Comparison (Less Than) Source: https://helm.sh/docs/chart_template_guide/function_list Use wildcard characters (`x`, `X`, `*`) with comparison operators like `<=`. This example checks for versions less than `3.0.0`. ```go-template "<= 2.x" ``` -------------------------------- ### Helm Create Command Options Source: https://helm.sh/docs/helm/helm_create Available options for the 'helm create' command, including the '-p' or '--starter' flag to specify a Helm starter scaffold. ```bash -h, --help help for create -p, --starter string the name or absolute path to Helm starter scaffold ``` -------------------------------- ### Helm Completion Help Options Source: https://helm.sh/docs/helm/helm_completion Displays the help options for the Helm completion command. ```bash helm completion --help ``` -------------------------------- ### Wildcard Comparison (Greater Than or Equal) Source: https://helm.sh/docs/chart_template_guide/function_list Use wildcard characters (`x`, `X`, `*`) with comparison operators like `>=`. This example checks for versions greater than or equal to `1.2.0`. ```go-template ">= 1.2.x" ``` -------------------------------- ### Minimal Whitespace in Helm Template Source: https://helm.sh/docs/chart_best_practices/templates This example demonstrates the preferred minimal whitespace for Helm chart templates, ensuring a clean output. ```yaml apiVersion: batch/v1 kind: Job metadata: name: example labels: first: first second: second ``` -------------------------------- ### Helm Repo Help Options Source: https://helm.sh/docs/helm/helm_repo Displays the help options for the 'helm repo' command. This is useful for understanding available flags and configurations. ```bash helm repo --help ``` -------------------------------- ### Helm Plugin List Command Usage Source: https://helm.sh/docs/helm/helm_plugin_list This is the basic command to list installed Helm plugins. It accepts flags to filter or modify the output. ```bash helm plugin list [flags] ``` -------------------------------- ### ConfigMap with Upper and Quote Pipeline Source: https://helm.sh/docs/chart_template_guide/functions_and_pipelines This example shows chaining the 'upper' and 'quote' functions using a pipeline to transform a value to uppercase and then quote it. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | quote }} food: {{ .Values.favorite.food | upper | quote }} ``` -------------------------------- ### Helm Registry Help Options Source: https://helm.sh/docs/helm/helm_registry Displays help information for the Helm registry command. This is useful for understanding available flags. ```bash helm registry --help ``` -------------------------------- ### Create a Helm List Source: https://helm.sh/docs/chart_template_guide/function_list Demonstrates how to create a basic list of integers in Helm. Lists are immutable data types. ```helm $myList := list 1 2 3 4 5 ``` -------------------------------- ### Incorrect Documentation for values.yaml Parameters Source: https://helm.sh/docs/chart_best_practices/values Illustrates incorrect documentation for `values.yaml` parameters, where comments do not start with the parameter name. This makes automated documentation generation difficult. ```yaml # the host name for the webserver serverHost: example serverPort: 9191 ``` -------------------------------- ### Manual Dependency Management via charts/ directory Source: https://helm.sh/docs/topics/charts Example structure showing how chart dependencies can be managed by placing them directly within the parent chart's `charts/` directory. ```yaml wordpress: Chart.yaml # ... charts/ apache/ Chart.yaml # ... mysql/ Chart.yaml # ... ``` -------------------------------- ### Supplying Values to Chart and Dependencies Source: https://helm.sh/docs/topics/charts This example shows how a values file can supply values to the main chart (WordPress) and its dependencies (MySQL, Apache). Values are namespaced according to the dependency. ```yaml title: "My WordPress Site" # Sent to the WordPress template mysql: max_connections: 100 # Sent to MySQL password: "secret" apache: port: 8080 # Passed to Apache ``` -------------------------------- ### Helm Get Manifest Command Source: https://helm.sh/docs/helm/helm_get_manifest This is the basic syntax for the `helm get manifest` command. Replace `RELEASE_NAME` with the name of your Helm release. ```bash helm get manifest RELEASE_NAME [flags] ``` -------------------------------- ### Helm Plugin Help Option Source: https://helm.sh/docs/helm/helm_plugin Displays help information for the 'helm plugin' command. ```bash -h, --help help for plugin ``` -------------------------------- ### Testing a standalone subchart Source: https://helm.sh/docs/chart_template_guide/subcharts_and_globals Install and test a subchart independently using Helm. This command simulates an installation without actually applying changes. ```bash $ helm install --generate-name --dry-run --debug mychart/charts/mysubchart ``` -------------------------------- ### Get a Value from a Dictionary with `get` Source: https://helm.sh/docs/chart_template_guide/function_list Retrieve a value from a dictionary using its key. If the key is not found, an empty string is returned without error. ```go-template get $myDict "name1" ``` -------------------------------- ### Correct Documentation for values.yaml Parameters Source: https://helm.sh/docs/chart_best_practices/values Shows the correct way to document parameters in `values.yaml`. Each comment should start with the parameter name, followed by a description, facilitating easier documentation extraction. ```yaml # serverHost is the host name for the webserver serverHost: example # serverPort is the HTTP listener port for the webserver serverPort: 9191 ``` -------------------------------- ### Helm Get Values Command Synopsis Source: https://helm.sh/docs/helm/helm_get_values This is the basic syntax for the `helm get values` command. Replace RELEASE_NAME with the name of your Helm release. ```bash helm get values RELEASE_NAME [flags] ``` -------------------------------- ### Chart Versioning Example Source: https://helm.sh/docs/topics/charts More complex SemVer 2 names are supported, such as versions with pre-release tags and build metadata. Non-SemVer names are disallowed, with exceptions for formats like 'x' or 'x.y' which are coerced into valid semantic versions. ```text 1.2.3-alpha.1+ef365 ``` -------------------------------- ### Helm Get Metadata Options Source: https://helm.sh/docs/helm/helm_get_metadata These are the specific options available for the 'helm get metadata' command, including help, output format, and revision selection. ```bash -h, --help help for metadata ``` ```bash -o, --output format prints the output in the specified format. Allowed values: table, json, yaml (default table) ``` ```bash --revision int specify release revision ``` -------------------------------- ### Helm Chart Directory Structure Source: https://helm.sh/docs/helm/helm_create This example illustrates the default directory structure created by 'helm create'. It includes essential files like Chart.yaml, values.yaml, and template directories. ```bash foo/ ├── .helmignore # Contains patterns to ignore when packaging Helm charts. ├── Chart.yaml # Information about your chart ├── values.yaml # The default values for your templates ├── charts/ # Charts that this chart depends on └── templates/ # The template files └── tests/ # The test files ``` -------------------------------- ### Helm Get Metadata Command Syntax Source: https://helm.sh/docs/helm/helm_get_metadata This is the basic syntax for the 'helm get metadata' command. Replace RELEASE_NAME with the actual name of your Helm release. ```bash helm get metadata RELEASE_NAME [flags] ``` -------------------------------- ### Help Option for Uninstall Source: https://helm.sh/docs/helm/helm_plugin_uninstall Displays help information for the 'helm plugin uninstall' command, including available options. ```bash helm plugin uninstall --help ``` -------------------------------- ### Helm Dependency Help Command Source: https://helm.sh/docs/helm/helm_dependency Displays help information for the 'helm dependency' command. ```bash helm dependency --help ``` -------------------------------- ### Helm Repo Add Command Usage Source: https://helm.sh/docs/helm/helm_repo_add This is the basic syntax for adding a chart repository. Replace [NAME] with a unique name for the repository and [URL] with the repository's index URL. ```bash helm repo add [NAME] [URL] [flags] ``` -------------------------------- ### Helm Search Help Options Source: https://helm.sh/docs/helm/helm_search Displays help information for the helm search command, including its available options. ```bash -h, --help help for search ``` -------------------------------- ### Dry Run Install Output Showing Global Values Source: https://helm.sh/docs/chart_template_guide/subcharts_and_globals A dry run install demonstrates how global values are rendered in the final Kubernetes manifests for both the main chart and its subcharts. ```yaml # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: silly-snake-configmap data: salad: caesar --- # Source: mychart/charts/mysubchart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: silly-snake-cfgmap2 data: dessert: ice cream salad: caesar ``` -------------------------------- ### Helm Get Notes Command Options Source: https://helm.sh/docs/helm/helm_get_notes These are specific options available for the 'helm get notes' command. The '--revision' flag allows you to specify a particular revision of the release. ```bash -h, --help help for notes --revision int get the named release with revision ``` -------------------------------- ### Wildcard Comparison (Any Version) Source: https://helm.sh/docs/chart_template_guide/function_list Use the asterisk (`*`) as a wildcard to match any version, equivalent to `>= 0.0.0`. ```go-template "*" ``` -------------------------------- ### Helm Get Values Command Options Source: https://helm.sh/docs/helm/helm_get_values These are the specific options available for the `helm get values` command. Use `-a` to dump all computed values, or `-o` to specify the output format. ```bash -a, --all dump all (computed) values -h, --help help for values -o, --output format prints the output in the specified format. Allowed values: table, json, yaml (default table) --revision int get the named release with revision ``` -------------------------------- ### Correct Naming Conventions for Chart Values Source: https://helm.sh/docs/chart_best_practices/values Use camelCase starting with a lowercase letter for user-defined values. This avoids conflicts with Helm's built-in variables which start with an uppercase letter. ```yaml chicken: true chickenNoodleSoup: true ``` -------------------------------- ### Example Custom Resource Instance (mycrontab.yaml) Source: https://helm.sh/docs/topics/charts A Helm template file that creates an instance of a custom resource defined by a CRD. This template uses standard Helm templating to define the resource's metadata and spec. ```yaml apiVersion: stable.example.com kind: CronTab metadata: name: {{ .Values.name }} spec: # ... ``` -------------------------------- ### Override a value using --set flag during helm install Source: https://helm.sh/docs/chart_template_guide/values_files Illustrates how to override a value from `values.yaml` by using the `--set` flag during `helm install`. This demonstrates the precedence of `--set` over default values. ```text $ helm install solid-vulture ./mychart --dry-run=client --debug --set favoriteDrink=slurm install.go:158: [debug] Original chart version: "" install.go:175: [debug] CHART PATH: /home/bagratte/src/playground/mychart NAME: solid-vulture LAST DEPLOYED: Wed Feb 19 23:25:54 2020 NAMESPACE: default STATUS: pending-install REVISION: 1 TEST SUITE: None USER-SUPPLIED VALUES: favoriteDrink: slurm COMPUTED VALUES: favoriteDrink: slurm HOOKS: MANIFEST: --- # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: solid-vulture-configmap data: myvalue: "Hello World" drink: slurm ``` -------------------------------- ### Helm Search Repo Command Syntax Source: https://helm.sh/docs/helm/helm_search_repo Displays the basic syntax for the 'helm search repo' command. ```bash helm search repo [keyword] [flags] ``` -------------------------------- ### Helm Get Notes Inherited Parent Command Options Source: https://helm.sh/docs/helm/helm_get_notes These options are inherited from parent commands and can be used with 'helm get notes'. They control aspects like Kubernetes API connection, client-side throttling, and output formatting. ```bash --burst-limit int client-side default throttling limit (default 100) --color string use colored output (never, auto, always) (default "auto") --colour string use colored output (never, auto, always) (default "auto") --content-cache string path to the directory containing cached content (e.g. charts) (default "~/.cache/helm/content") --debug enable verbose output --kube-apiserver string the address and the port for the Kubernetes API server --kube-as-group stringArray group to impersonate for the operation, this flag can be repeated to specify multiple groups. --kube-as-user string username to impersonate for the operation --kube-ca-file string the certificate authority file for the Kubernetes API server connection --kube-context string name of the kubeconfig context to use --kube-insecure-skip-tls-verify if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kube-tls-server-name string server name to use for Kubernetes API server certificate validation. If it is not provided, the hostname used to contact the server is used --kube-token string bearer token used for authentication --kubeconfig string path to the kubeconfig file -n, --namespace string namespace scope for this request --qps float32 queries per second used when communicating with the Kubernetes API, not including bursting --registry-config string path to the registry config file (default "~/.config/helm/registry/config.json") --repository-cache string path to the directory containing cached repository indexes (default "~/.cache/helm/repository") --repository-config string path to the file containing repository names and URLs (default "~/.config/helm/repositories.yaml") ``` -------------------------------- ### Create a Basic ConfigMap Template Source: https://helm.sh/docs/chart_template_guide/getting_started This is a minimal Kubernetes ConfigMap resource that will be processed by the Helm template engine. Place this file in the `mychart/templates/` directory. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: mychart-configmap data: myvalue: "Hello World" ``` -------------------------------- ### Helm Repo List Command Options Source: https://helm.sh/docs/helm/helm_repo_list These are the specific options available for the 'helm repo list' command, including help and output formatting. ```bash -h, --help help for list --no-headers suppress headers in the output -o, --output format prints the output in the specified format. Allowed values: table, json, yaml (default table) ``` -------------------------------- ### YAML Comment Example Source: https://helm.sh/docs/chart_best_practices/templates This snippet shows a standard YAML comment, denoted by the '#' symbol. ```yaml # This is a comment type: sprocket ``` -------------------------------- ### Get Length of Argument with len Source: https://helm.sh/docs/chart_template_guide/function_list The `len` function returns the length of its argument as an integer. ```gotemplate len .Arg ``` -------------------------------- ### Install Helm Completion for All Fish Sessions Source: https://helm.sh/docs/helm/helm_completion_fish To ensure Helm autocompletion is available every time you open a new Fish shell session, redirect the output of `helm completion fish` to a file in the Fish completions directory. ```bash helm completion fish > ~/.config/fish/completions/helm.fish ``` -------------------------------- ### Helm Create Command Syntax Source: https://helm.sh/docs/helm/helm_create The basic syntax for the 'helm create' command. It takes a NAME argument for the chart directory. ```bash helm create NAME [flags] ``` -------------------------------- ### YAML List Representation Source: https://helm.sh/docs/chart_best_practices/templates Demonstrates a standard YAML list format for arguments. ```yaml arguments: - "--dirname" - "/foo" ``` -------------------------------- ### Overly Aggressive Whitespace Chomping Source: https://helm.sh/docs/chart_template_guide/control_structures An example demonstrating how excessive whitespace chomping can merge lines of YAML. ```yaml food: {{ .Values.favorite.food | upper | quote }} {{- if eq .Values.favorite.drink "coffee" -}} mug: "true" {{- end -}} ``` -------------------------------- ### Incorrect YAML Output Source: https://helm.sh/docs/chart_template_guide/control_structures Example of the incorrect YAML generated by the initial template due to whitespace issues. ```yaml # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: eyewitness-elk-configmap data: myvalue: "Hello World" drink: "coffee" food: "PIZZA" mug: "true" ``` -------------------------------- ### Create a Dictionary with `dict` Source: https://helm.sh/docs/chart_template_guide/function_list Use the `dict` function to create a dictionary by passing a list of key-value pairs. The keys must be strings. ```go-template $myDict := dict "name1" "value1" "name2" "value2" "name3" "value 3" ``` -------------------------------- ### Get Initials from Words with initials Source: https://helm.sh/docs/chart_template_guide/function_list The `initials` function extracts the first letter of each word in a string and concatenates them. ```go-template initials "First Try" ``` -------------------------------- ### Format String with printf Source: https://helm.sh/docs/chart_template_guide/function_list Use `printf` for formatted string output. It takes a format string and arguments, using placeholders like `%s` for strings and `%d` for integers. ```go-template printf "%s has %d dogs." .Name .NumberDogs ``` -------------------------------- ### Using `include` and `nindent` for Correct Indentation Source: https://helm.sh/docs/chart_template_guide/named_templates Corrects the previous example by using the `include` function combined with `nindent` to properly format the output of the named template within the ConfigMap. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap labels: {{- include "mychart.app" . | nindent 4 }} data: myvalue: "Hello World" {{- range $key, $val := .Values.favorite }} {{ $key }}: {{ $val | quote }} {{- end }} {{- include "mychart.app" . | nindent 2 }} ``` -------------------------------- ### Extract Substring with substr Source: https://helm.sh/docs/chart_template_guide/function_list The `substr` function extracts a portion of a string using start and end indices. ```go-template substr 0 5 "hello world" ``` -------------------------------- ### Kubernetes Version Constraints Source: https://helm.sh/docs/topics/charts Define semver constraints for supported Kubernetes versions. Helm validates these constraints during installation. ```yaml >= 1.13.0 < 1.15.0 ``` ```yaml >= 1.13.0 < 1.14.0 || >= 1.14.1 < 1.15.0 ``` -------------------------------- ### Example of Base64 Encoded Secret Source: https://helm.sh/docs/chart_template_guide/accessing_files This snippet shows the resulting Kubernetes Secret after a file has been base64 encoded and embedded. ```yaml # Source: mychart/templates/secret.yaml apiVersion: v1 kind: Secret metadata: name: lucky-turkey-secret type: Opaque data: token: |- bWVzc2FnZSA9ICJIZWxsbyBmcm9tIGNvbmZpZyAxIgo= ``` -------------------------------- ### Help for Logout Command Source: https://helm.sh/docs/helm/helm_registry_logout Displays help information for the `helm registry logout` command, including available flags and their descriptions. ```bash helm registry logout --help ``` -------------------------------- ### Get Values from a Dictionary Source: https://helm.sh/docs/chart_template_guide/function_list Extracts all values from a single dictionary into a list. Ordering is not guaranteed; use `sortAlpha` if needed. ```go $vals := values $myDict ``` -------------------------------- ### Get Sorted Keys from a Dictionary Source: https://helm.sh/docs/chart_template_guide/function_list Returns a sorted list of all keys from a dictionary. Use `sortAlpha` for predictable ordering. ```go keys $myDict | sortAlpha ``` -------------------------------- ### Helm Env Command Help Source: https://helm.sh/docs/helm/helm_env Access help information for the `helm env` command to understand its available flags and options. ```bash helm env --help ``` -------------------------------- ### Uninstall Helm Plugin Source: https://helm.sh/docs/helm/helm_plugin_uninstall Use this command to remove one or more installed Helm plugins. Specify the plugin name(s) after the command. ```bash helm plugin uninstall ... ```