Introduction

Helm allows overriding default chart values using the -f flag to specify a values file. When the specified file path does not exist, is not readable, or the working directory is incorrect, Helm aborts the installation. This is common in CI/CD pipelines where file paths differ between local development and build environments.

Symptoms

  • helm install fails with open values-override.yaml: no such file or directory
  • Error message points to the -f flag argument that cannot be resolved
  • Deployment works locally but fails in CI/CD pipeline
  • Multiple -f flags specified and one of them is missing
  • Error message: Error: open /path/to/values.yaml: no such file or directory

Common Causes

  • File path relative to the current working directory, which differs between environments
  • File not committed to the repository (in .gitignore or never added)
  • Typo in the filename or path in the CI/CD pipeline configuration
  • CI/CD pipeline step running in a different directory than expected
  • File permissions preventing the Helm process from reading the file

Step-by-Step Fix

  1. 1.Verify the file path exists: Check if the values file is present.
  2. 2.```bash
  3. 3.ls -la values-override.yaml
  4. 4.# Or for absolute path
  5. 5.ls -la /path/to/values-override.yaml
  6. 6.`
  7. 7.Use absolute paths in CI/CD pipelines: Avoid relative path issues.
  8. 8.```bash
  9. 9.# In CI/CD pipeline
  10. 10.helm install my-release ./chart \
  11. 11.-f "${CI_PROJECT_DIR}/helm/values-override.yaml" \
  12. 12.-n my-namespace
  13. 13.`
  14. 14.Check for multiple override files and verify each one: Ensure all -f files exist.
  15. 15.```bash
  16. 16.for f in values.yaml values-override.yaml values-env.yaml; do
  17. 17.[ -f "$f" ] && echo "Found: $f" || echo "Missing: $f"
  18. 18.done
  19. 19.`
  20. 20.Merge override files into a single file if appropriate: Reduce the number of -f flags.
  21. 21.```bash
  22. 22.yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' values.yaml values-override.yaml > merged-values.yaml
  23. 23.helm install my-release ./chart -f merged-values.yaml
  24. 24.`
  25. 25.Add file existence checks to the deployment script: Fail early with a clear message.
  26. 26.```bash
  27. 27.#!/bin/bash
  28. 28.VALUES_FILE="${1:-values.yaml}"
  29. 29.if [ ! -f "$VALUES_FILE" ]; then
  30. 30.echo "ERROR: Values file not found: $VALUES_FILE"
  31. 31.exit 1
  32. 32.fi
  33. 33.helm install my-release ./chart -f "$VALUES_FILE"
  34. 34.`

Prevention

  • Use absolute paths for all values files in CI/CD pipeline configurations
  • Include values file existence checks as the first step in deployment scripts
  • Version control all values override files and reference them by repository path
  • Document the expected directory structure and file paths in the chart's README
  • Use a single merged values file per environment to reduce path complexity
  • Test Helm install commands locally with the same directory structure as CI/CD