Declarative Resource Management

CNPA Domain: Platform Engineering Core Fundamentals (36%) Topic: Declarative Resource Management

Overview

Declarative resource management is the practice of describing the desired state of infrastructure and applications in configuration files, letting the system continuously reconcile toward that state. It is the cornerstone of modern platform engineering: combining Kubernetes manifests, Helm charts, and Kustomize overlays gives platform teams a powerful toolkit for consistent, auditable, and repeatable deployments.


Declarative vs Imperative

Approach
How
Example

Imperative

Tell the system what to do step by step

kubectl create deployment...

Declarative

Tell the system what you want, let it figure out how

Apply a YAML manifest

# Imperative β€” fragile, hard to reproduce
kubectl create deployment nginx --image=nginx:1.25
kubectl scale deployment nginx --replicas=3
kubectl expose deployment nginx --port=80

# Declarative β€” reproducible, version-controlled
kubectl apply -f deployment.yaml

The declarative model is the foundation of GitOps and Kubernetes-native platform workflows.


Kubernetes Manifests

Kubernetes manifests are YAML (or JSON) files that describe the desired state of Kubernetes resources.

Core Resource Types for Platform Engineers

Resource
Purpose

Deployment

Declarative Pod lifecycle management

Service

Stable network endpoint for Pods

ConfigMap

Non-sensitive configuration data

Secret

Sensitive configuration data

Namespace

Environment/tenant isolation

ResourceQuota

CPU/memory limits per namespace

LimitRange

Default resource requests per container

NetworkPolicy

Pod-to-pod traffic rules

ServiceAccount

Identity for workloads

Example: A Complete Application Manifest


Helm: Parametric Kubernetes Packaging

Helm is the package manager for Kubernetes, allowing you to define, install, and upgrade complex workloads as reusable charts.

Key Helm Concepts

Concept
Description

Chart

A package of Kubernetes templates + metadata

Values

User-supplied configuration that parameterizes templates

Release

A deployed instance of a chart

Repository

Collection of charts (like npm or PyPI)

Chart Structure

Parameterizing for Multiple Environments

Platform teams publish curated Helm charts as golden path templatesβ€”developers fill in values, the platform handles the rest.


Kustomize: Overlay-Based Customization

Kustomize is built into kubectl and enables environment-specific customization via overlays without templating.

Directory Structure

Helm vs Kustomize

Aspect
Helm
Kustomize

Approach

Templating with {{ }}

Pure YAML + patches

Learning curve

Medium

Low

Ecosystem

Huge chart library

Kubernetes-native

Best for

Complex parameterization

Simple environment overlays

GitOps support

Via Helm Controller

Native kubectl apply -k

Many teams use both: Helm for third-party charts, Kustomize for their own application overlays.


Desired State and Reconciliation

The declarative model introduces the concept of desired state vs actual state:

This is the foundation of GitOps: the Git repository is the single source of truth for desired state, and tools continuously reconcile the cluster toward it.


Resource Management Best Practices for Platform Teams

1. Always Set Resource Requests and Limits

2. Use ResourceQuotas per Namespace/Team

3. Label Everything Consistently

4. Separate Configuration from Code

Always use ConfigMaps and Secrets injected at runtime. Never bake environment-specific values into container images.


Key Takeaways

  • Declarative management describes desired state; the platform continuously reconciles actual state to match

  • Kubernetes manifests are the primitive β€” always prefer kubectl apply over imperative commands in production

  • Helm enables parameterized, reusable chart packaging useful for platform golden paths

  • Kustomize provides clean overlay-based customization without templating overhead

  • Set resource requests/limits and ResourceQuotas to prevent noisy-neighbor issues

  • Consistent labels are essential for observability, policy enforcement, and cost attribution


Further Reading

Last updated