Home > Mobile >  Are the resources in a kubernetes YAML manifest created in sequence?
Are the resources in a kubernetes YAML manifest created in sequence?

Time:10-08

Are the resources in a kubernetes YAML manifest created in sequence?

Say I have a manifest file like so

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
  namespace: default
data:
  prop.value: 1
----
apiVersion: v1
kind: Pod
metadata:
  name: test-pod
spec:
  containers:
    - name: test-container
      image: registry.k8s.io/busybox
      command: [ "/bin/sh", "-c", "env" ]
      env:
        - name: PROP_VALUE
          valueFrom:
            configMapKeyRef:
              name: app-config
              key: prop.value
  restartPolicy: Never

Will ConfigMap be created before Deployment, so Deployment can use the correct ConfigMap value?

CodePudding user response:

Yes: Manage Deployment

The resources will be created in the order they appear in the file.

But this should not matter too much in kubernetes. If the Deployment is created first, it will spawn the pods once the ConfigMap is ready.

  • Related