Defining Multiple Objects in the Same YAML File

Learn how to combine all the Services, API's and ReplicaSets into one YAML file.

Combining multiple YAML files into one file

All the YAML files defined in the previous lesson for Pods, Services, and API work together. But having four YAML definitions is confusing. It would get even more confusing later on since we are going to add more objects to the stack. Things would be much simpler and easier if we would move all the objects we created thus far into a single YAML definition. Fortunately, that is very easy to accomplish

Let’s take a look at yet another YAML file go-demo-2.yml in the code playground at the end of the lesson. It is the same as the contents of the previous four YAML files combined. The only difference is that each object definition is separated by three dashes (---).

Get hands-on with 1400+ tech skills courses.