Helm Get Values: Extract Secrets in Your K8s Cluster
Helm Get Values is a command used in Kubernetes, an open-source container orchestration platform, to retrieve values from ConfigMaps or Secrets. This command is part of the Kubernetes command-line interface (CLI) tool, kubectl. It enables developers and administrators to access and manage critical information securely stored in these Kubernetes objects.
ConfigMaps and Secrets are ways to store configuration data and sensitive information respectively in Kubernetes. They allow you to separate sensitive data from your container images, improving security and enabling you to manage changes to this data without rebuilding your container images.
Why Use Helm Get Values?
Helm is a package manager for Kubernetes that makes it easy to find, share, and use software built for Kubernetes. The helm get values command helps you to view the default values for a chart, along with any overrides that have been applied. This is useful for troubleshooting issues, understanding how a chart is configured, and ensuring that the correct values are being used.
The command can display the default values, show what values are currently being used, or both. This helps you to understand how the chart is configured and to identify any misconfigurations that may be causing issues.
Default Values
The helm get values command without any flags displays the default values for a chart. This is useful for understanding how the chart is configured out-of-the-box and for seeing what options are available for customization.
For example, if you have a chart with default values like this:
defaultValues:
replicas: 1
image:
repository: my-repository
tag: latest
service:
type: ClusterIP
Running helm get values <chart-name> would output:
replicas: 1
image:
repository: my-repository
tag: latest
service:
type: ClusterIP
Used Values
The --used flag causes helm get values to display the currently used values for a chart, including any overrides from values.yaml files or command-line flags. This helps you to understand how the chart is currently configured and to see what values are being used in practice.
For instance, if you have overridden some values like this:
helm install my-release ./charts/my-chart --set replicas=3 --set image.tag=v1.0.0 --set service.type=NodePort
Running helm get values my-release --used would output:
replicas: 3
image:
tag: v1.0.0
service:
type: NodePort
Best Practices
While helm get values is a powerful tool for understanding chart configurations, it should be used judiciously. Abusing it can lead to sensitive data being exposed in logs or being stored in unsafe locations, such as startup scripts or version control systems.
Here are some best practices to consider:
- Only expose sensitive values when necessary. Consider using environment variables or secrets for sensitive data.
- Be careful with default values. Make sure they don't reveal sensitive information or mislead users about the chart's functionality.
- Regularly review and audit your chart's configurations to ensure they remain up-to-date and secure.
In the world of Kubernetes, understanding and managing chart configurations is key to running robust, secure applications. The helm get values command is an important tool in this process, helping you to understand and control your chart's configurations, thereby improving your applications' performance and security.