Karmada Documentation

repository·master·Indexed 26 days ago

https://github.com/karmada-io/karmada

An open-source, multi-cluster Kubernetes orchestration system for seamless application management across multiple clouds and clusters using native Kubernetes APIs. Documentation covers installation and management of the Karmada control plane, Karmada Operator, and Karmada Agent via Helm, including configuration for etcd, encryption-at-rest, and certificate management.

Tokens
190.3K
Snippets
276
Records
854
Agent score
88%

What's inside Karmada

  1. Overview of Karmada

    master
    Karmada (Kubernetes Armada) is a Kubernetes management system designed for multi-cloud and multi-cluster orchestration. It allows you to run cloud-native applications across multiple Kubernetes clusters and clouds without changing your application code. It is K8s-native, meaning it uses standard Kubernetes APIs and integrates seamlessly with existing toolchains. Key capabilities include centralized management, high availability, failure recovery, and advanced multi-cluster scheduling policies (e.g., Cluster Affinity, Multi-Cluster Splitting/Rebalancing).
  2. Overview of FederatedHPA in Karmada

    master

    FederatedHPA is a solution designed to manage Horizontal Pod Autoscaling (HPA) across multiple Kubernetes clusters. It addresses the limitations of single-cluster HPA, such as resource exhaustion in a single cluster and the complexity of managing redundant HPA resources in multi-cluster environments.

    Key Capabilities

    • Unified Management: Manage HPA resources in a single location rather than configuring them separately in every member cluster.
    • Cross-Cluster Scaling: Scale workloads across multiple clusters using PropagationPolicy to determine where replicas are placed (e.g., scaling up more instances in clusters with higher resource availability).
    • Metric Support: Supports standard Kubernetes HPA metrics (CPU/Memory) as well as customized metrics via a metrics adapter.
    • Stability and Cost Control: Improves service availability by scaling across clusters to avoid single-cluster resource limits and allows setting maximum instance thresholds to prevent unexpected cloud costs.

    Important Constraints

    • Load Distribution: Workloads/pods in different member clusters selected by the same FederatedHPA resource share the application load proportionally to their pod count. For example, if 10 pods are distributed as 3 in cluster1 and 7 in cluster2, cluster1 handles 3/10 of the requests and cluster2 handles 7/10.
    • Scheduling: FederatedHPA focuses on scaling the number of replicas; the actual placement of those replicas is handled by the Karmada scheduler via PropagationPolicy.
  3. Implement stateful application failover

    master
    Starting from v1.12.0, Karmada supports stateful application failover. This allows users to define application state preservation during cluster-to-cluster failovers. This is particularly useful for data-processing CRDs (like Flink or Spark) where applications need to resume from a previous checkpoint to avoid double processing or data loss during rescheduling.
  4. Understand the Thirdparty Resource Interpreter structure

    master

    The Thirdparty Resource Interpreter allows Karmada to handle custom resources from third-party applications and operators. Customizations are defined via YAML files and organized by API group, version, and kind.

    Directory Structure:

    resourcecustomizations/
    ├── <group>/
    │   └── <version>/
    │       └── <kind>/
    │           ├── customizations.yaml                # Resource interpreter customization rules
    │           └── testdata/
    │               ├── <operation>-test.yaml          # Test cases for specific operations
  5. Understand Binding Priority and Preemption in Karmada

    master

    Karmada supports priority and preemption for bindings (ResourceBinding and ClusterResourceBinding). This allows the scheduler to distinguish between high-priority critical tasks and non-urgent tasks during resource contention.

    • Priority: A value assigned to a binding that determines its scheduling order. Priorities are independent of workload type and follow a total order.
    • Binding Preemption: An action where the scheduler clears the scheduling results of lower-priority bindings to satisfy the requirements of a higher-priority pending binding when member clusters lack sufficient resources.

    Note: Binding preemption is distinct from policy preemption, which involves high-priority policies preempting low-priority policies.

  6. Karmada Architecture and Components

    master

    The Karmada Control Plane consists of three primary components:

    • Karmada API Server: The REST endpoint for all components.
    • Karmada Controller Manager: Performs operations based on API objects. It runs several specialized controllers:
      • Cluster Controller: Manages the lifecycle of member clusters.
      • Policy Controller: Watches PropagationPolicy objects to select resources and create ResourceBinding objects.
      • Binding Controller: Watches ResourceBinding objects to create Work objects.
      • Execution Controller: Watches Work objects to distribute resources to member clusters.
    • Karmada Scheduler: Handles scheduling logic.

    ETCD is used to store all Karmada API objects.

  7. Karmada v1.13.0 New Features

    master

    Version 1.13.0 introduced several significant features and optimizations:

    • Application Priority Scheduling: Enhanced scheduling capabilities based on application priority.
    • Resource Scheduling Suspend and Resume: Support for suspending and resuming resource scheduling.
    • Karmada Operator Enhancements: Continuous improvements to the Karmada Operator.
    • Controller Performance Optimization: Remarkable performance optimizations for Karmada controllers.
    • Karmada Dashboard: Release of the first version of the official Karmada Dashboard.
  8. Understand the Accurate Estimator logic

    master

    The accurate estimator in Karmada calculates the maximum number of replicas (maxReplica) that can be scheduled on a cluster by combining multiple plugin results.

    To account for resource fragmentation, the estimator follows these steps:

    1. Plugin Execution: Runs maxReplicas calculation for each enabled plugin (e.g., quota-aware plugins).
    2. Node Summation: Loops through all nodes and sums up the amount of replicas (sumReplicas) that can fit in each node.
    3. Final Result: Returns Math.min(maxReplicas, sumReplicas).

    This ensures that the estimation respects both cluster-wide quotas and the physical capacity of individual nodes.