惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
Jina AI
Jina AI
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
博客园 - 司徒正美
罗磊的独立博客
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Vercel News
Vercel News
A
About on SuperTechFans
I
InfoQ
D
DataBreaches.Net
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队

Sealos Blog

Build a Full-Stack App with Claude Code + InsForge — Zero Backend Code | Sealos Blog InsForge vs Supabase: Which Backend for AI-Powered Development? | Sealos Blog Kubernetes NodePort Exhaustion: SSH Gateway Solution | Sealos Blog Claude Code Metrics Dashboard: Grafana Setup (2026) | Sealos Blog What Is RustFS? Apache 2.0 MinIO Alternative (2026) | Sealos Blog Claude Code Mobile: iPhone, Android & SSH (2026) | Sealos Blog Eaglercraft Server Hosting: Fast Setup (2026) | Sealos Blog An Honest Review: Migrating a Complex Microservice App from Heroku to Sealos | Sealos Blog The Ultimate Guide to Kubernetes Audit Logging for Security and Compliance | Sealos Blog Cost Optimization Shootout: Sealos Autonomous FinOps vs. Kubecost Manual Reports | Sealos Blog For CTOs: How to Cut Your Cloud Bill by 50% Without Sacrificing Performance | Sealos Blog Building Resilient Systems: A Deep Dive into Sealos High-Availability and Auto-Failover | Sealos Blog Building a Scalable Event-Driven Architecture with Sealos Managed Kafka | Sealos Blog Beyond kubectl apply: 5 GitOps Best Practices for Production-Ready CI/CD on Sealos | Sealos Blog Advanced RAG Pipelines: Why Your Choice of Vector Database (like Milvus) Matters | Sealos Blog Advanced MLOps: How to Monitor and Evaluate LLM Applications in Production | Sealos Blog A Developer's Guide to Kubernetes RBAC: Securing Your Cluster the Easy Way with Sealos | Sealos Blog A CISO's Guide to Cloud Development: Securing the CI/CD Pipeline with Sealos DevBox | Sealos Blog What is Kubernetes Multi-Tenancy? A Guide for Platform Engineers | Sealos Blog What is Infrastructure from Code (IfC)? The Next Step After Infrastructure as Code (IaC) | Sealos Blog What is GitOps? A Beginner's Guide to "Push-to-Deploy" Workflows | Sealos Blog What is eBPF? The Future of Kubernetes Networking and Security | Sealos Blog What is an "AI-Native" Platform? (And Why You Need One for MLOps) | Sealos Blog What is an Agentic Workflow? Building the Next Generation of AI Apps | Sealos Blog What is a Kubernetes Chargeback Model (And How Does it Save You Money?) | Sealos Blog What is a "Headless" Development Environment? (And How it Works with VS Code) | Sealos Blog What is a Graph-Based Vector Database? (And When to Use It Over Milvus) | Sealos Blog What is a "Cloud Operating System"? The Next Evolution of PaaS Explained | Sealos Blog The Real Cost of EKS: How Sealos Delivers a Simpler, Cheaper Kubernetes Experience | Sealos Blog The 3 Types of Kubernetes Autoscaling (HPA, VPA, CA) and How Sealos Manages Them for You | Sealos Blog
What is a Custom Resource Definition (CRD) in Kubernetes?...
Sealos · 2025-08-29 · via Sealos Blog

Kubernetes is incredibly powerful because it provides a rich set of building blocks for running applications. We have Pods, Deployments, Services, Secrets, and more. Think of these as the standard vocabulary that Kubernetes understands right out of the box.

But what happens when this standard vocabulary isn't enough? What if you want to manage a concept that is unique to your application, like a DatabaseBackup, a MlTrainingJob, or a WebsiteCertificate, and treat it as a first-class citizen in your cluster? Shoving complex configuration into a generic ConfigMap feels messy and unintuitive. You want to speak your application's language.

This is exactly why Kubernetes provides Custom Resource Definitions (CRDs). A CRD is a powerful feature that allows you to teach Kubernetes new words, extending its API to understand and manage concepts that are specific to your domain.

In this guide, we'll explain what a CRD is, how it lets you create your own Kubernetes objects, and how it serves as the foundation for the powerful Operator pattern.

Let's start with what Kubernetes already knows. It's like a chef who has a set of well-known, standardized recipes. These are the built-in resources:

  • Deployment: A recipe for running a stateless application.
  • StatefulSet: A recipe for running a stateful application with a stable identity.
  • Service: A recipe for creating a stable network endpoint for your Pods.
  • ConfigMap: A recipe for storing non-sensitive configuration data.

These resources are the generic, all-purpose tools that can build almost anything. However, a Deployment object doesn't understand what a "WordPress installation" is; it only understands how to manage a set of identical Pods. You, the human, have to maintain the mental model that connects a specific Deployment, Service, and PersistentVolumeClaim together to form "WordPress."

The Analogy: Imagine you're a building manager using a software system. The system understands Apartments, Tenants, and LeaseAgreements. If the tenants want to start a weekly book club, how do you manage that in the system? You could put a note in a LeaseAgreement's description field, but that's a hack. The system doesn't natively understand what a BookClub is, so it can't manage it intelligently.

A Custom Resource Definition (CRD) is a way to create a brand-new resource type in your Kubernetes cluster. It's the mechanism for extending the Kubernetes API with your own objects.

When you create a CRD, you are effectively telling your Kubernetes cluster's API server:

"Hey, from now on, I want you to recognize a new object kind called BookClub. It should have a spec that includes fields like meetingDay, genre, and memberCount."

Creating a CRD is like adding a new, custom recipe card to the chef's cookbook. The chef now has a formal, structured way to understand and prepare a new dish. In our building manager analogy, it's like adding a new module to the software that natively understands and manages BookClub objects.

Once a CRD is applied to a cluster, the Kubernetes API server dynamically creates a new RESTful API endpoint for that resource type. You can now interact with your new object using kubectl, just like you would with a built-in resource.

It's important to distinguish between two related terms:

  1. Custom Resource Definition (CRD): This is the schema or the template. You define the structure of your new object: its name, its fields, and their types (e.g., string, integer). You typically create a CRD only once per object type.
  2. Custom Resource (CR): This is an instance of your CRD. It's a specific object you create that conforms to the schema defined in the CRD. You can create as many CRs as you want.

So, first you create the BookClub CRD. Then, your tenants can create multiple CRs:

Now, you can manage these objects with familiar commands: kubectl get bookclubs.

So, you've taught Kubernetes a new word. Now what? By itself, a CRD only gives you a way to store and retrieve structured data in the Kubernetes API. This isn't very useful on its own.

The true power of CRDs is unleashed when you pair them with a custom controller. This is the heart of the Operator Pattern.

A custom controller is the active, logical component. It's a program that runs in your cluster and "watches" your custom resources. When you create, update, or delete a CR, the controller notices and takes action. This is the reconciliation loop.

  • The CRD is the declarative "what." It's the user's intent: "I want a fantasy book club that meets on Wednesdays."
  • The Controller is the imperative "how." It contains the operational logic to make that intent a reality: "Okay, a new BookClub object was created. I will now book the community room every Wednesday, send an email to the members, and update the building's event calendar."

This combination allows you to create powerful, declarative APIs for your own applications, automating complex tasks that would otherwise require manual intervention.

While CRDs are the key to unlocking true cloud-native automation, building the custom controllers that bring them to life is a serious software engineering effort. How can you get the benefits of this powerful pattern without having to build it all yourself?

The Sealos platform and its App Store are built upon the most robust and mature CRDs and Operators in the Kubernetes ecosystem.

  • When you deploy a database cluster, Sealos uses a high-level CRD like PostgresCluster to declaratively manage it.
  • When you set up monitoring, Sealos leverages the Prometheus and ServiceMonitor CRDs to automate configuration.

Sealos provides a simple, graphical interface that allows you to create and manage these powerful Custom Resources without ever writing YAML or understanding the complex controller logic behind them. It effectively democratizes access to the most advanced automation patterns Kubernetes has to offer.

Custom Resource Definitions are a fundamental feature for extending Kubernetes beyond its initial design. They allow you to transform the Kubernetes API into one that understands the specific language of your applications. While a CRD defines the schema for a new object, it's the combination with a custom controller that unlocks true automation, forming the basis of the Operator pattern. This enables a declarative, self-managing system for even the most complex software.

Ready to harness the declarative power of Kubernetes for your own applications without the development overhead? Explore the Sealos App Store and see how custom resources simplify complex application management.