Kubernetes CRD to Sample YAML

A simple, fast and free online tool to generate sample YAML objects from Kubernetes Custom Resource Definitions

Input CRD YAML

Configuration Options

Sample Generation Options

Generate sample values for non-required properties

Prefer example values from the schema over generated ones

Add apiVersion, kind, metadata fields to the sample

Sample YAML Output

How to Use

  1. Enter or paste your Kubernetes Custom Resource Definition (CRD) YAML in the input field on the left.
  2. Configure the generation options based on your needs:
    • Include optional fields: Generate sample values for non-required properties
    • Use schema examples: Prefer example values from the schema when available
    • Include metadata: Add standard Kubernetes metadata fields
  3. Click the "Generate Sample YAML" button to create a sample resource.
  4. The generated sample YAML will appear in the output field on the right.
  5. Use "Copy to Clipboard" or "Download YAML" to save your result.

Examples

Simple CRD Example

Input CRD:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: myapps.example.com
spec:
  group: example.com
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              replicas:
                type: integer
              image:
                type: string

Generated Sample:

apiVersion: example.com/v1
kind: MyApp
metadata:
  name: sample-myapp
  namespace: default
spec:
  replicas: 3
  image: "nginx:latest"

Complex CRD with Arrays

Input CRD:

spec:
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              containers:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    ports:
                      type: array
                      items:
                        type: integer

Generated Sample:

spec:
  containers:
  - name: "container-1"
    ports:
    - 8080
    - 9090

Supported Schema Types

  • string: Generates sample text values
  • integer/number: Generates numeric values
  • boolean: Generates true/false values
  • array: Generates arrays with sample items
  • object: Generates nested objects
  • enum: Picks first enum value
  • examples: Uses provided example values

Use Cases

  • • Testing custom resources locally
  • • Creating documentation examples
  • • Understanding CRD structure
  • • Generating template manifests
  • • API development and testing
  • • Kubernetes operator development

About Kubernetes CRD to Sample YAML

This tool helps Kubernetes developers and operators generate sample YAML manifests from Custom Resource Definitions (CRDs). It's particularly useful for:

The tool parses the OpenAPI v3 schema from your CRD and intelligently generates sample values based on the field types, constraints, and examples defined in the schema. It supports complex nested structures, arrays, enums, and all standard JSON schema types.

Related Tools