Skip to content

Instantly share code, notes, and snippets.

@jpbetz
Last active March 10, 2026 18:42
Show Gist options
  • Select an option

  • Save jpbetz/376d861e6d098af421bd094046624986 to your computer and use it in GitHub Desktop.

Select an option

Save jpbetz/376d861e6d098af421bd094046624986 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-configmap
namespace: default
labels:
app: my-sample-app
data:
# Configuration key-value pairs
database_url: "postgresql://db.example.com:5432/mydb"
log_level: "INFO"
enable_experimental_features: "true"
# Multi-line configuration file example
app.properties: |
color.good=purple
color.bad=yellow
allow.textmode=true
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-configmap
namespace: default
labels:
app: my-sample-app
resourceVersion: "10"
data:
# Configuration key-value pairs
database_url: "postgresql://db.example.com:5432/mydb"
log_level: "INFO"
enable_experimental_features: "true"
# Multi-line configuration file example
app.properties: |
color.good=purple
color.bad=yellow
allow.textmode=true
kubectl create -f create.yaml.yaml

kubectl get -f create.yaml -oyaml --show-managed-fields=true

# Try to apply with a stale RV:
kubectl apply --server-side -f patch.yaml --force-conflicts -v 9

"Response" verb="PATCH" url="https://127.0.0.1:6443/api/v1/namespaces/default/configmaps/sample-configmap?fieldManager=kubectl&fieldValidation=Strict&force=false" status="409 Conflict" headers=<
	Audit-Id: 9dfc1da0-0274-430a-ac84-d8cd4c8554ba
	Cache-Control: no-cache, private
	Content-Length: 328
	Content-Type: application/json
	Date: Tue, 10 Mar 2026 18:35:25 GMT
	X-Kubernetes-Pf-Flowschema-Uid: c7a450a1-c5d0-4a3d-ad99-51b0287ae844
	X-Kubernetes-Pf-Prioritylevel-Uid: 8a702e7f-885a-45ca-bef5-4c706d7183a1
 > milliseconds=3 getConnectionMilliseconds=0 serverProcessingMilliseconds=3
I0310 14:35:25.951952 2490583 helper.go:269] "Response Body" body=<
	{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Operation cannot be fulfilled on configmaps \"sample-configmap\": the object has been modified; please apply your changes to the latest version and try again","reason":"Conflict","details":{"name":"sample-configmap","kind":"configmaps"},"code":409}
 >
error: Operation cannot be fulfilled on configmaps "sample-configmap": the object has been modified; please apply your changes to the latest version and try again
Please review the fields above--they currently have other managers. Here
are the ways you can resolve this warning:
* If you intend to manage all of these fields, please re-run the apply
  command with the `--force-conflicts` flag.
* If you do not intend to manage all of the fields, please edit your
  manifest to remove references to the fields that should keep their
  current managers.
* You may co-own fields by updating your manifest to match the existing
  value; in this case, you'll become the manager if the other manager(s)
  stop managing the field (remove it from their configuration).
See https://kubernetes.io/docs/reference/using-api/server-side-apply/#conflicts

# Now try without a RV:
kubectl apply --server-side -f create.yaml --force-conflicts -v 9

SUCCESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment