cancel
Showing results for 
Search instead for 
Did you mean: 
  • 12.7K Views

How to learn configuration YAML files

I have been learning Kubernetes intermittently for over a year now.

The hardest part for me is the YAML configurations. Usually, a configuration file contains an apiVersion, kind, metadata, and spec. And then spec contains template, which contains spec again. And this is not always the same. Formats differ for each different kind. I have to memorize a lot of things, and I have to check every time against a reference.

What is the best way to learn Kubernetes configurations? Do we have to grab configuration files and apply them every time instead of writing them? Is this the recommended way?

This question is part of the 100K Member Contest - don't forget to kudo the original contest post to be entered. 

Labels (2)
Tags (2)
32 Replies
  • 3,111 Views

I think we just need to understand the YAML after that it will be easy to work on YAML. Also, we need to have knowledge on the key value for configuration

CarlosT
Cadet
Cadet
  • 2,852 Views

A brief overview about yaml syntax,

https://docs.ansible.com/ansible/2.9/reference_appendices/YAMLSyntax.html

 

Although for your use case, I think is useful the kubectl/oc explain command.

oc explain pod

oc explain pod.spec

oc explain deploy

...

oc explain <resource> 

With this command you can discover and learn posible attributes in the kubernetes/openshift manifests. 

vikash01
Mission Specialist
Mission Specialist
  • 2,865 Views

YAML is a data serialization language that is often used for writing configuration files. Depending on whom you ask, YAML stands for yet another markup language or YAML ain't markup language (a recursive acronym), which emphasizes that YAML is for data, not documents.

0 Kudos
crkrishnadas
Mission Specialist
Mission Specialist
  • 2,858 Views

Try to understand the basic syntax and the purpose while laying into YAML. If you have a basic knowledge you can explore the entire configuration features very nicely. Can learn using the courses, YouTube etc.. 

0 Kudos
tanmoy
Cadet
Cadet
  • 2,849 Views

In my opinion RHCE on Ansible(RH294) is the best way to learn YAML. For automation YAML is best format and RHCE on Ansible is the easiest way to learn the same

Germanusp82
Mission Specialist
Mission Specialist
  • 2,833 Views

Not an expert in this area. In dealing with a few config files for Ansible and any container orchestration platform I have tried to learn or use, the best way is to learn by working on it more. It is hard to memorize the syntax. As we start developing these config files and putting them to use, we will go through the process of making mistakes, discovering them when testing, research on troubleshooting them, interact with community, get resolutions, apply and overcome the issue and then move on to the next problem solving cycle.

misanche
Flight Engineer
Flight Engineer
  • 2,829 Views

you can always use the oc client to ask about the spec

AlexonOliveira
Flight Engineer
Flight Engineer
  • 2,826 Views

Psehgaf
Flight Engineer
Flight Engineer
  • 2,823 Views

I think it's simple and even more so if you've already developed before, I remember that in school some teachers were very strict so that the spacing and tabulation was consistent and elegant, then I used json, and when YAML came along it really didn't cost me much because I liked to tabulate and space everything, the navigation style is very similar to that of a json without the {}

• ╚╬╦╬Psehgaft╬╦╬╝ ◦
Gineesh
Flight Engineer
Flight Engineer
  • 2,814 Views

We had a session earlier, have a look and see if its useful: https://www.techbeatly.com/demystifying-yaml-for-ansible/

If you are still struggling with YAML and JSON, have a look at this free course. This is for YAML + JSON parsing.
https://kodekloud.com/courses/json-path-quiz/

 

Join the discussion
You must log in to join this conversation.