|
||
---|---|---|
.github | ||
artifacts | ||
cluster/images/karmada-controller-manager | ||
cmd | ||
docs | ||
hack | ||
pkg | ||
samples/nginx | ||
test | ||
vendor | ||
.gitignore | ||
.golangci.yml | ||
LICENSE | ||
Makefile | ||
README.md | ||
go.mod | ||
go.sum |
README.md
Karmada
Karmada (Kubernetes Armada) is a multi-cluster management system speaks Kubernetes native API. Karmada aims to provide turnkey automation for multi-cluster application management in multi-cloud and hybrid cloud scenarios, and intended to realize multi-cloud centralized management, high availability, failure recovery and traffic scheduling.
Its key capabilities include:
- Cross-cluster applications managements based on K8s native API, allow user migrate apps from single cluser to multi-cluster conveniently and quickly.
- Support provisioning or attaching Kubernetes clusters for centralized operations and management.
- Cross-cluster applications auto-scaling ,failover and loadbalancing on multi-cluster.
- Advanced scheduling strategy: region, available zone, cloud provider, cluster affinity/anti-affinity.
Architecture
The Karmada Control Plane consists of the following components:
- ETCD for storing the karmada API objects
- Karmada API Server
- Karmada Controller Manager
- Karmada Scheduler
ETCD stores the karmada API objects, the API Server is the REST endpoint all other components talk to, and the Karmada Controller Manager perform operations based on the API objects you create through the API server.
The Karmada Controller Manager runs the various controllers, the controllers watch karmada objects and then talk to the underlying clusters’ API servers to create regular Kubernetes resources.
-
Cluster Controller: attach kubernetes clusters to Karmada for managing the lifecycle of the clusters by creating membercluster object.
-
Policy Controller: the controller watches PropagationPolicy objects. When PropagationPolicy object is added, it selects a group of resources matching the resourceSelector and create PropagationBinding with each single resource object.
-
Binding Controller: the controller watches PropagationBinding object and create PropagationWork object corresponding to each cluster with single resource manifest.
-
Excution Controller: the controller watches PropagationWork objects.When PropagationWork objects are created, it will distribute the resources to member clusters.
Concepts
Resource template: Karmada uses Kubernetes Native API definition for federated resource template, to make it easy to integrate with existing tools that already adopt on Kubernetes
Propagation Policy: Karmada offers standalone (placement) policy API to define spreading requirements.
- Support 1:n mapping of Policy: workload, users don't need to indicate scheduling constraints every time creating federated applications.
- With default policies, users can just interact with K8s API
Override Policy: Karmada provides standalone override API for specializing cluster relevant configuration automation. E.g.:
- Override image prefix according to member cluster region
- Override StorageClass according to cloud provider
The following diagram shows how Karmada resources are involved when propagating resources to member clusters.
Quickstart
Please install kind and kubectl before the following steps.
Install karmada
- Clone this repo to get karmada.
git clone https://github.com/huawei-cloudnative/karmada
- Move to the karmada package directory.
cd karmada
- Install karmada.
export KUBECONFIG=/root/.kube/karmada.config
hack/local-up-karmada.sh
- Verify that karmada's component is deployed and running.
kubectl get pods -n karmada-system
Join member cluster
- Create member cluster for attaching it to karmada.
hack/create-cluster.sh member-cluster-1 /root/.kube/membercluster1.config
- Join member cluster to karmada using karmadactl.
make karmadactl
./karmadactl join member-cluster-1 --member-cluster-kubeconfig=/root/.kube/membercluster1.config
- Verify member cluster is Joined to karmada successfully.
kubectl get membercluster -n karmada-cluster
Propagate application
- Create nginx deployment in karmada.
export KUBECONFIG=/root/.kube/karmada.config
kubectl create -f samples/nginx/deployment.yaml
- Create PropagationPolicy that will propagate nginx to member cluster.
export KUBECONFIG=/root/.kube/karmada.config
kubectl create -f samples/nginx/propagationpolicy.yaml
- Verify the nginx is deployed successfully in member-cluster-1.
export KUBECONFIG=/root/.kube/membercluster1.config
kubectl describe deploy nginx