Kubernetes CRD to Sample YAML

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

Popular CRDs Catalog

Select from a catalog of popular Kubernetes operators and their CRDs

Input CRD YAML

Or manually enter your CRD YAML below

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

Option 1: Use Popular CRDs Catalog

  1. Search and select a Kubernetes operator from the "Select Operator" dropdown.
  2. Once an operator is selected, search and select a specific CRD from the "Select CRD" dropdown.
  3. Click "Load Selected CRD" to automatically fetch the CRD schema from GitHub.
  4. The CRD will be loaded into the input field and you can proceed to generate a sample.

Option 2: Manual CRD Input

  1. Enter or paste your Kubernetes Custom Resource Definition (CRD) YAML in the input field.
  2. You can also click "Load Sample CRD" to see an example CRD structure.

Generate Sample YAML

  1. 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
  2. Click the "Generate Sample YAML" button to create a sample resource.
  3. The generated sample YAML will appear in the output field on the right.
  4. 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