There’s no escape from the YAML monster if you’re doing anything related to Kubernetes and here we’ll give you the knowledge needed to conquer this best.
Have no fear, there are many tools out there to help you with these tasks, and Monokle is one of them!
Now, let’s get down to basics…
A Kubernetes Manifest is a specification of a Kubernetes API object in JSON or YAML format. A manifest specifies the desired state of an object that Kubernetes will maintain when you apply the manifest. A configuration file can contain multiple manifests.
YAML stands for “YAML Ain't Markup Language” and is a human-readable text-based format that helps you specify information in your configurations. It’s vital for anyone working with containerized web applications and deploying them to Kubernetes. This is because YAML manifest files are what communicate with Kubernetes for a successful deployment. While YAML was initially meant to be an easy-to-read language, it’s also easy to make mistakes when creating manifests. From syntax issues to other errors, Manifests can be finicky.
Below, is an example of basic manifest structure:
Here are the following elements that we can see in the example above, and what they mean:
apiVersion: Specifies the API version of Kubernetes
kind: Specifies type of Kubernetes resource, in the example above the type is “deployment”
metadata: This is where we find information about the deployment, likes names and labels
spec: This is the desired state of your deployment, including things like the number replicas and the pod template.
replicas: specifies the number of replicas to be made
selector: how replicas are selected
matchLabels: specifies which labels that each replica should match
template: specifies which pod template for which replica
containers: specifies which container to run in the pod
name: the name of the container
image: specifies which docker image
ports: which ports to expose within the container
The apiVersion and kind of the manifest will specify which schema to use.
A manifest schema defines the “content” of the manifest and is not to be confused with Kubernetes itself!
The following is an example of what a manifest schema looks like
Manifest schemas are used to validate manifest files. When a manifest is validated, the schema is then used to check that the manifest file contains the required information and that it's formatted correctly.
Manifest schemas are also used to generate documentation for manifest files. When a manifest is documented, the manifest schema is used to generate a document that describes its structure and contents.
Kubernetes manifest relationships are the way that Kubernetes objects are connected to each other. These relationships are used to define how Kubernetes objects interact with each other.
There are a number of different types of Kubernetes manifest relationships. Some of the most common types of relationships include:
Manifest relationships are defined using the Kubernetes API, which provides a number of different methods for creating, deleting and updating relationships.
Kubernetes manifest relationships are ultimately used to manage the complexity of Kubernetes clusters. By defining how Kubernetes objects interact, manifest relationships ensure that clusters are stable and reliable.
Below are some examples of what these relationships look like in practice:
Kubernetes manifest relationships are a powerful tool for managing Kubernetes clusters. Just like in real life, understanding how relationships work means you can create more complex and reliable applications in Kubernetes.
You can also use Monokle to help manage your own complex clusters! Check out how to leverage Monokle in your Kubernetes lifecycle here
Now that we understand the foundations of our YAML and K8s Manifests, how they form relationships and how they relate to the world of Kubernetes, it’s time to apply our new knowledge! Below, you’ll find resources on how to leverage Monokle for editing and managing your YAML Manifests and Kubernetes clusters. And next time, we’ll go over everything you need to know to start utilizing YAML templates, and navigating through the Kubernetes lifecycle.
See you then.
Monokle helps you achieve high-quality Kubernetes deployments throughout the entire application lifecycle—from code to cluster. It enables your team to define Kubernetes configuration policies to ensure consistent, secure, and compliant application deployments every time. In addition to policy enforcement, Monokle’s ecosystem of tools make your team’s daily YAML configuration workflows easier. Get started with Monokle for free.