Use Harness Config Files in Manifests
You can use files added to the Config Files section in your Kubernetes Service in your manifests, such as in a ConfigMap. You can reference unencrypted and encrypted files, and they can be single or multiline.
In this topic:
- Before You Begin
- Review: Config Files Encoding and References
- Step 1: Add the File to Config Files
- Step 2: Reference Config File
- Step 3: Decode the File
- Next Steps
Before You Begin
Review: Config Files Encoding and References
Files added in the Config Files section are referenced using the configFile.getAsString("fileName")
Harness expression:
configFile.getAsString("fileName")
- Plain text file contents.configFile.getAsBase64("fileName")
- Base64-encoded file contents.
Step 1: Add the File to Config Files
In this example, we will use a file in a ConfigMap object.
- Add the unencrypted file to Config Files. In this example, the file is a base64 encoded file named
myFile
.

The base64 encoded file will be decoded when added to the manifest, as shown below.
Step 2: Reference Config File
- In the values.yaml in the Harness Service Manifests section, reference the Config File using
my_file: ${configFile.getAsBase64("myFile")}
.

Step 3: Decode the File
- In the manifest (in our example, a ConfigMap), decode the base64 Config File and indent it for the YAML syntax:
data:
keyname: |
{{.Values.my_file | b64dec | indent 4}}
At runtime, the Config File is decoded and used as plaintext.