The Big Picture - fluxcd/flux2 - YAML

YAML (YAML Ain’t Markup Language) is a popular data serialization standard used extensively in the Kubernetes ecosystem, including in Flux2. It is human-readable, easy to write and understand, and can be used to define and manage infrastructure, configuration, and application deployments.

Description

Flux2 uses YAML manifests to define and manage the desired state of your Kubernetes clusters. YAML is a human-friendly data serialization standard that is widely adopted in the Kubernetes community. The yaml library is a definitive library for YAML, supporting both YAML 1.1 and YAML 1.2 and all common data schemas. It is released under the ISC open source license and has no external dependencies.

Installation

To use YAML in your Flux2 project, you don’t need to install any additional libraries as it is natively supported by Flux2 and Kubernetes.

Usage

Flux2 reads YAML manifests from a Git repository or similar artifact hosting, such as OCI registries, and applies them to your Kubernetes clusters based on the desired state defined in the manifests. Each revision in the Git repository or artifact represents a new desired state for the cluster workloads.

Example

Here’s an example of a simple YAML manifest for a Kubernetes Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: my-image:latest
ports:
- containerPort: 80

This YAML manifest defines a Kubernetes Deployment named my-app with three replicas, a container named my-container running the image my-image:latest, and an exposed port of 80.

Conclusion

YAML is a crucial component of Flux2, as it is used to define and manage the desired state of your Kubernetes clusters. Its human-friendly format makes it easy to write, understand, and collaborate on, making it an essential tool for managing infrastructure and applications in a modern, cloud-native environment.

For more information on using YAML with Flux2, refer to the Flux2 documentation.

Sources: