'Created' vs 'Unchanged' vs 'Configured' when using 'apply'

4/25/2019

When creating config maps 'apply -f ' will return either 'created', 'configured' or 'unchanged' but when creating an empty config map (i.e. the data: portion is empty) then it always seems to return 'configured'. Can anyone explain these responses as I can't seem to find them in the docs

(creating a config map with data gives expected results: 'created' first time, 'configured'/'unchanged' thereon depending on updates)

example empty config map:

apiVersion: v1
kind: ConfigMap
metadata:
  name: test-config
  namespace: test
  labels:
    app: test
data:
-- Dexter Barnes
kubernetes

1 Answer

5/7/2019

When you are using kubectl create -f you can notice: created, already exists

When you are using kubectl apply -f you can notice: created, configured, during this first operation was created Annotations: kubectl.kubernetes.io/last-applied-configuration.

Please run kubectl get cm <your ConfigMap> -n <namespace> -o yaml and verify your ConfigMap

As per documentation for "Declarative object configuration" here:

Note: Declarative object configuration retains changes made by other writers, even if the changes are not merged back to the object configuration file. This is possible by using the patch API operation to write only observed differences, instead of using the replace API operation to replace the entire object configuration.

Please use: kubectl diff -f <your configmap yaml file> to see the differences between your configuration and live configuration and what will be replaced by patch API operation.

It depends also "How different types of fields are merged" you can find detailed information here

Hope this help.

-- Hanx
Source: StackOverflow