Welcome to the Linux Foundation Forum!

Does the indentation mean anything for list elements in Kubernetes yaml?

does the indentation mean anything for list elements in Kubernetes yaml ? For example, in the pod yaml under Use-Case: As container environment variables "- name" under "containers:" is indented, however, "- secretRef" under "envFrom" is not indented...

Comments

  • FlamentBrunoFlamentBruno Posts: 9
    edited July 24

    Hello,
    Not related to Kubernetes.
    yaml works like this.

  • chrispokornichrispokorni Posts: 549

    Hi @Ryan-Chase,

    In this specific example, - name is evaluated the same way, with or without indentation:

    With indentation (as presented in the example):

    spec:
      containers:
        - name: test-container
          image: k8s.gcr.io/busybox
    

    Without indentation:

    spec:
      containers:
      - name: test-container
        image: k8s.gcr.io/busybox
    

    Regards,
    -Chris

Sign In or Register to comment.