Phase 2: From YAML to Deployment: Building a Robust Multi-Cloud Kubernetes CLI

In the previous part of this series ( Phase 1 ), I shared why I'm building a multi-cloud CLI platform to help platform teams self-serve Kubernetes infrastructure in AWS, Azure, and GCP without needing ticket-based provisioning
In this Phase 2 blog, we dive into input validation, YAML schema enforcement, default config handling, and how we're building a resilient CLI with a clean command structure.
π― Objective of Phase 2
Once we allowed teams to define their infra needs in a YAML file, the next critical step was:
How do we make sure that YAML is correct, complete, and safe to process?
The answer: schema validation, fallback defaults, and structured commands.
π¦ Schema-Based Validation with JSONSchema
We created structured JSONSchema definitions for each cloud provider:
configs/schema/
βββ aws-schema.yaml
βββ azure-schema.yaml
βββ gcp-schema.yaml
Each schema defines:
Required fields (like
cloud
,account
,cluster
,nodeGroups
,addons
)Data types (e.g., strings, integers, booleans)
Nested object structures
This ensures users donβt miss critical config like cluster.version
or nodeGroups[].instanceType
.
π§° Fallback Defaults for Missing Fields
We also introduced support for default values using files like:
configs/defaults/aws-defaults.yaml
If a user skips optional fields in their input config, these are merged automatically. This allows a smoother experience for teams who want a quick start.
π οΈ Centralized Validation Utility
To keep things DRY and consistent, we created:
utils/validation.py
This file contains:
def validate_config_file(config_path: str) -> dict:
...
Which:
Loads the user YAML file
Detects cloud (aws/azure/gcp)
Loads the matching schema
Validates it using
jsonschema
Returns a fully validated config dict
Can later merge with defaults
π§± CLI Command Architecture (After Phase 2)
infra-cli <command> --config-file <path>
Each CLI command now runs validation internally using the utility module.
β
validate
infra-cli validate --config-file examples/aws-sample.yaml
Purpose: Only checks schema validity
Output: β or β with helpful error messages
Great for CI/CD pipelines
β
load
infra-cli load --config-file examples/aws-sample.yaml
Purpose: Human-readable summary
Validates schema + prints cloud, cluster, region, version, environment
Great for devs verifying input before render
β
render
infra-cli render --config-file examples/aws-sample.yaml
Purpose: Renders a final cluster config file from templates using validated YAML
Internally uses Jinja2 to generate cloud-native config for eksctl, az, gcloud
β
apply
infra-cli apply --config-file examples/aws-sample.yaml
Purpose: Executes provisioning using
eksctl
,az aks
, orgcloud
Validates input before applying
Future-proof to plug in Terraform
π§ͺ Difference Between load
and validate
Feature | load | validate |
Purpose | Human-readable preview | Pass/fail check for CI |
Output | Cloud, cluster, region summary | β /β only |
Audience | Dev teams | Automation/CI/CD |
Both are needed β one for humans, one for machines.
π Project Structure Snapshot
multi-cloud-infra-cli/
βββ cli/ # All subcommands
β βββ render_templates.py
β βββ load_config.py
β βββ apply_infra.py
β βββ validate_config.py
βββ utils/
β βββ validation.py # Shared schema validation logic
βββ configs/
β βββ schema/ # Per-cloud JSONSchema definitions
β βββ defaults/ # Default config fallbacks
βββ examples/ # Sample input YAMLs
β βββ aws-sample.yaml
βββ templates/ # Jinja templates per cloud
βββ output/ # Rendered cluster config files
π Whatβs Coming in Phase 3
In Phase 3, weβll make apply
actually provision infra by integrating with:
eksctl
for AWSaz aks
for Azuregcloud container clusters
for GCP
Then, weβll move toward GitOps support so the provisioning becomes declarative and auditable.
π§ Final Thoughts
This phase improved our CLIβs usability, safety, and developer trust. Users now get instant feedback on bad input, and confidence that render
and apply
wonβt break due to missing fields.
Stay tuned for Phase 3 β where infrastructure comes to life.
π Repo Link: https://github.com/prathyushreddy123/k8-infra-cli
π Try it Now:
infra-cli validate --config-file examples/aws-sample.yaml
infra-cli load --config-file examples/aws-sample.yaml
infra-cli render --config-file examples/aws-sample.yaml
If you're building internal platforms, I'd love your feedback β or contributions π
Subscribe to my newsletter
Read articles from Prathyush Dommata directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Prathyush Dommata
Prathyush Dommata
With 10 years of experience as a DevOps, SRE, and Cloud Engineer, Iβve worked across various tech stacks, always eager to explore new tools and best practices. Iβm particularly interested in AI and MLOps, and I enjoy diving deep into projects to gain hands-on experience. I believe the best way to learn is by building from scratch, and through this blog, I aim to share insights, challenges, and lessons from my journey. Whether it's automation, cloud infrastructure, or AI-driven workflows, Iβm always curious to explore whatβs next.