Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e246c3c
Create editing-configmaps.md
iRaindrop Oct 21, 2025
d05c343
Update .nav.yml
iRaindrop Oct 21, 2025
a42327c
Update editing-configmaps.md
iRaindrop Oct 24, 2025
275dd3c
Update editing-configmaps.md
iRaindrop Oct 24, 2025
04fe58e
Update editing-configmaps.md
iRaindrop Oct 27, 2025
e2decb8
Update editing-configmaps.md
iRaindrop Oct 28, 2025
a9eaaff
Update editing-configmaps.md
iRaindrop Oct 28, 2025
3df551f
Update editing-configmaps.md
iRaindrop Oct 29, 2025
420803a
Update editing-configmaps.md
iRaindrop Oct 30, 2025
ee3de62
Update editing-configmaps.md
iRaindrop Nov 4, 2025
6ed1846
Update editing-configmaps.md
iRaindrop Nov 4, 2025
79b5502
Update editing-configmaps.md
iRaindrop Nov 4, 2025
5257455
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 8, 2025
9d97ee8
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 8, 2025
9f65498
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 8, 2025
ef280e8
Update editing-configmaps.md
iRaindrop Nov 12, 2025
c4ae66c
Update editing-configmaps.md
iRaindrop Nov 12, 2025
8af3db7
Nav update and annotation testing
iRaindrop Nov 12, 2025
0bec94e
Update editing-configmaps.md
iRaindrop Nov 12, 2025
ff4dac3
Update editing-configmaps.md
iRaindrop Nov 12, 2025
410abd8
Update editing-configmaps.md
iRaindrop Nov 12, 2025
6301800
Update editing-configmaps.md
iRaindrop Nov 13, 2025
8d4cf07
Update editing-configmaps.md
iRaindrop Nov 13, 2025
20432ae
Update editing-configmaps.md
iRaindrop Nov 13, 2025
604589e
Update editing-configmaps.md
iRaindrop Nov 13, 2025
b117812
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 13, 2025
e8cc852
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 13, 2025
a096d97
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 13, 2025
de63c7d
Update docs/versioned/admin/editing-configmaps.md
iRaindrop Nov 13, 2025
6f1a4c4
Update editing-configmaps.md
iRaindrop Nov 13, 2025
ae69227
Update admin-overview.md
iRaindrop Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/versioned/.nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ nav:
# Vendor list
- Using a Knative-based offering: install/knative-offerings.md
- Configuring Knative:
# TODO: add a doc on editing ConfigMaps
- Working with ConfigMaps: admin/editing-configmaps.md
- Configure high-availability components: serving/config-ha.md
- Exclude namespaces from the Knative webhook: serving/webhook-customizations.md
- Networking Options:
Expand Down
2 changes: 2 additions & 0 deletions docs/versioned/admin/admin-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Knative configurations are performed by the following methods:

Store and manage configuration data as key-value pairs. ConfigMaps are frequently used to tune platform-wide behavior. Most of the Knative ConfigMaps are in the `knative-serving` and `knative-eventing` namespaces. Their settings apply to all the relevant Knative components in all namespaces.

See [Working with ConfigMaps](editing-configmaps.md) for important usage information and best practices.

- Using the Knative Operator

Some platform-wide settings can be managed declaratively using the Knative Operator.
Expand Down
75 changes: 75 additions & 0 deletions docs/versioned/admin/editing-configmaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
audience: administrator
components:
- serving
- eventing
function: explanation
---

# Working with ConfigMaps

This page provides important Knative-specific information and best practices for managing cluster configuration using ConfigMaps. ConfigMaps are the primary means for managing configuration values for Knative controllers.

If you are using the Knative Operator to install and manage your Knative cluster, you should not edit the ConfigMaps directly as the Operator will overwrite the changes. See [Configuring Knative by using the Operator](../install/operator/configuring-with-operator.md) for information on how to manage ConfigMaps using the operator.

## The _example key

ConfigMap files installed by Knative contain an `_example` key that shows the usage and purpose of all the known configuration keys in that ConfigMap. This key does not affect Knative behavior, but does contains a value which acts as a documentation comment.

If a user edits the `_example` key rather than creating a new key in the ConfigMap, the changes won't affect the cluster cluster configuration, which can be confusing. The Knative webhook flags this error and alerts the user that their update could not be patched. More specifically, the edit is caught when the checksum for the `_example` key differs from the `knative.dev/example-checksum` annotation on the ConfigMap. If the checksum is null or missing, the webhook does not create the warning.

Accordingly, you cannot alter the contents of the `_example` key, but you can delete the `_example` key altogether or delete the `example-checksum` annotation.

For example, the following YAML code shows the first 24 lines of the `config-defaults` ConfigMap with the checksum highlighted on line 11.

```yml linenums="1" hl_lines="11"
piVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
labels:
app.kubernetes.io/name: knative-serving
app.kubernetes.io/component: controller
app.kubernetes.io/version: devel
annotations:
knative.dev/example-checksum: "5b64ff5c"
data:
_example: |
################################
# #
# EXAMPLE CONFIGURATION #
# #
################################

# This block is not actually functional configuration,
# but serves to illustrate the available configuration
# options and document them in a way that is accessible
# to users that `kubectl edit` this config map.
#
```

## Best practices

### Validate and Test Changes

Knative controllers process new values, including roll-backs to previous values, within a few seconds after being applied.

- Before applying ConfigMaps, validate their syntax and content using tools like `kubeval` or use `kubectl apply --dry-run=server`.
- Test ConfigMap changes in a staging environment to ensure compatibility with the application version.

### Storage and versioning

How you manage storage relates the canonical locations of both the cluster and Git. If your cluster is canonical, then you're exporting or backing up the configuration to Git. If Git is canonical, then you're practicing GitOps, and you should make changes in Git and then apply the files from Git to your cluster.

If you manage the ConfigMap by using `kubectl edit`, periodically export ConfigMaps from the cluster with `kubectl get configmap -o yaml` and commit them to Git for recovery purposes. Include applicable version numbers in `app.properties` as needed.

If you manage the ConfigMap by keeping the definition in Git and automatically applying it to the cluster (GitOps), you can apply the changes manually or use automation (for example Flux or ArgoCD) to apply the changes after they are committed.

### Git recommendations

In addition to diligent usage of commit messages, here are some suggestions for ConfigMaps in GitHub:

- Centralize ConfigMaps: Store all ConfigMaps in a dedicated directory in your Git repository, such as `k8s/configmaps/`.
- Tag commits in Git with version numbers, such as `git tag config-v1.2.3` to mark specific ConfigMap versions.
- Implement a GitOps workflow with tools like ArgoCD or Flux to synchronize ConfigMaps from Git to your Kubernetes cluster.
Loading