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.
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
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.
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.
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..
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
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.
you can always use the oc client to ask about the spec
I recommend the following readings:
https://www.tutorialspoint.com/yaml/index.htm
https://www.redhat.com/sysadmin/yaml-beginners
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 {}
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/
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.