πŸ”§ DevOps

Crossplane

Crossplane

Managing cloud infrastructure with Kubernetes. Integrated control plane.

Detailed Explanation

Crossplane is an open-source project that extends Kubernetes to manage cloud infrastructure. Started by Upbound in 2018, it became a CNCF incubating project and presents a new paradigm for cloud-native infrastructure management.

Unlike Terraform, Crossplane runs on top of the Kubernetes control plane. When you declare cloud resources such as AWS S3, GCP Cloud SQL, and Azure CosmosDB as Custom Resources (CRs), controllers create the actual resources and maintain the desired state.

The Composition feature lets you define high-level abstractions (Composite Resources) that combine multiple resources. When a platform team provides PostgreSQL + backup + monitoring as a single "Database" resource, development teams use it without needing complex infrastructure details.

In practice, it is used to provide self-service infrastructure in Kubernetes-based platform engineering. Combined with GitOps, infrastructure changes are managed with ArgoCD, and per-team permissions are controlled with RBAC. Unified management is possible in multi-cloud environments.

Code Example

# Composition - μΆ”μƒν™”λœ Database λ¦¬μ†ŒμŠ€ μ •μ˜
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: postgres-aws
spec:
  compositeTypeRef:
    apiVersion: database.example.com/v1alpha1
    kind: PostgreSQLInstance
  resources:
    # RDS μΈμŠ€ν„΄μŠ€
    - name: rds-instance
      base:
        apiVersion: rds.aws.upbound.io/v1beta1
        kind: Instance
        spec:
          forProvider:
            engine: postgres
            engineVersion: "15"
            instanceClass: db.t3.medium
            allocatedStorage: 20
            publiclyAccessible: false
            skipFinalSnapshot: true
      patches:
        - fromFieldPath: spec.storageGB
          toFieldPath: spec.forProvider.allocatedStorage
        - fromFieldPath: spec.parameters.instanceClass
          toFieldPath: spec.forProvider.instanceClass

    # λ³΄μ•ˆ κ·Έλ£Ή
    - name: security-group
      base:
        apiVersion: ec2.aws.upbound.io/v1beta1
        kind: SecurityGroup
        spec:
          forProvider:
            description: PostgreSQL access
---
# κ°œλ°œνŒ€μ΄ μ‚¬μš©ν•˜λŠ” κ°„λ‹¨ν•œ μš”μ²­
apiVersion: database.example.com/v1alpha1
kind: PostgreSQLInstance
metadata:
  name: my-app-db
spec:
  storageGB: 50
  parameters:
    instanceClass: db.t3.large

How It's Said in Practice

Senior: "Every time the dev team needs a DB or S3, they open a ticket with the infrastructure team. If we build a self-service portal with Crossplane, they can create it themselves with a single YAML."

Junior: "How is it different from Terraform?"

Senior: "Terraform is batch-oriented, while Crossplane does continuous reconciliation. It automatically detects and recovers from resource drift. The integration with the Kubernetes ecosystem is also more natural."

Interviewer: "Why is Crossplane's Composition important?"

Candidate: "Composition lets the platform team abstract complex infrastructure and provide it as a simple API. Developers don't need to know the internal implementation: a single 'Database' request automatically provisions RDS, security groups, and even backup policies. It enables separation of concerns and governance."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

Reviewer: "The credentials are directly in the ProviderConfig. It would be better to separate them into a Secret and manage them with ESO (External Secrets Operator)."

Developer: "Right, I'll switch to IRSA (IAM Roles for Service Accounts). It will also reduce the key management burden."

Cautions

Learn More