The model command manages infrastructure models, which define the types of components and their relationships available in Meshery.
Synopsis
mesheryctl model [subcommand] [flags]
Subcommands
list - List all available models
view - View model details
search - Search for models by name or category
import - Import models from files or URLs
export - Export models to files
delete - Delete a model from the registry
generate - Generate models from source definitions
init - Initialize a new model structure
build - Build OCI-compliant model packages
Global Flags
Display total count of models
list
List all available infrastructure models.
Usage
mesheryctl model list [flags]
Flags
Page number for pagination
Number of models per page
Display only the count of models
Examples
# List all models
mesheryctl model list
# Get model count
mesheryctl model list --count
Sample Output
MODEL CATEGORY VERSION
Kubernetes Orchestration v1.28.0
Istio Service Mesh 1.19.0
Prometheus Observability v2.45.0
NGINX Ingress Network 1.9.0
Total: 250 models
view
Display detailed information about a model.
Usage
mesheryctl model view [model-name] [flags]
Flags
Output format: yaml, json. Short form: -o
Examples
# View model in YAML
mesheryctl model view Kubernetes
# View in JSON format
mesheryctl model view Istio -o json
Sample Output
name: Kubernetes
category: Orchestration
version: v1.28.0
displayName: Kubernetes
components:
- Pod
- Service
- Deployment
- ConfigMap
relationships: 45
metadata:
source: kubernetes.io
published: true
search
Search for models by name, category, or other attributes.
Usage
mesheryctl model search [search-term] [flags]
Flags
Examples
# Search for Kubernetes models
mesheryctl model search kubernetes
# Search for service mesh models
mesheryctl model search --category "Service Mesh"
import
Import models from files or URLs.
Usage
mesheryctl model import [flags]
Flags
Path to model file or URL. Short form: -f
Examples
# Import a model file
mesheryctl model import -f model.yaml
# Import from directory
mesheryctl model import -f ./models/
Imported models are validated against the Meshery schema before being added to the registry.
export
Export models to files.
Usage
mesheryctl model export [model-name] [flags]
Flags
--output
string
default:"./model.yaml"
Output file path. Short form: -o
Examples
# Export model to file
mesheryctl model export Kubernetes -o k8s-model.yaml
# Export to directory
mesheryctl model export Istio -o ./exports/
delete
Delete a model from the registry.
Usage
mesheryctl model delete [model-id] [flags]
Examples
# Delete by ID
mesheryctl model delete 7e8b42f9-0e5c-4b7a-8f3d-9c2e1a6b5d4c
Only custom models can be deleted. Built-in models registered by Meshery cannot be removed.
generate
Generate models from source definitions.
Usage
mesheryctl model generate [flags]
Flags
Source to generate from (e.g., OpenAPI spec, Helm chart)
Output directory for generated model. Short form: -o
Examples
# Generate from OpenAPI specification
mesheryctl model generate --source api-spec.yaml -o ./models
init
Scaffold a new model directory structure.
Usage
mesheryctl model init [model-name] [flags]
Examples
# Initialize new model structure
mesheryctl model init my-custom-model
# Creates:
# my-custom-model/
# ├── model.yaml
# ├── components/
# └── relationships/
Generated Structure
my-custom-model/
├── model.yaml # Model definition
├── components/ # Component definitions
│ └── example.yaml
└── relationships/ # Relationship definitions
└── example.yaml
build
Build OCI-compliant packages from model files.
Usage
mesheryctl model build [model-name] [flags]
mesheryctl model build [model-name]/[model-version] [flags]
Flags
Output directory for the OCI package. Short form: -o
Examples
# Build latest version
mesheryctl model build my-model
# Build specific version
mesheryctl model build my-model/v1.0.0
Sample Output
Building OCI package for my-model...
Packaging components: 15
Packaging relationships: 8
Package created: ./my-model-v1.0.0.tar.gz
Count Models
Display the total number of registered models.
Usage
Example Output
Model Categories
Models are organized into categories:
- Orchestration - Container orchestration platforms (Kubernetes, Docker Swarm)
- Service Mesh - Service mesh technologies (Istio, Linkerd, Consul)
- Observability - Monitoring and logging (Prometheus, Grafana, Jaeger)
- Network - Networking components (NGINX, Traefik, Cilium)
- Security - Security tools (Falco, OPA, cert-manager)
- Storage - Storage solutions (Rook, Longhorn, MinIO)
- Database - Database systems (PostgreSQL, MySQL, Redis)
Model Structure
A model definition includes:
name: MyModel
version: 1.0.0
category: Orchestration
displayName: My Custom Model
metadata:
description: Custom infrastructure model
source: custom
components:
- name: MyComponent
version: 1.0.0
kind: Deployment
relationships:
- name: ComponentBinding
type: edge
Troubleshooting
Import Fails
# Validate model syntax
mesheryctl model view my-model -o yaml
# Check for schema violations
# Ensure model follows Meshery model schema
Model Not Found
# List all models
mesheryctl model list
# Search for model
mesheryctl model search my-model
Build Errors
# Verify model structure
ls -R my-model/
# Ensure model.yaml exists and is valid
cat my-model/model.yaml
See Also