Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docs on dynamic scheduling and status aggregation (#26)
Signed-off-by: Di Xu <stephenhsu90@gmail.com>
- Loading branch information
Showing
11 changed files
with
458 additions
and
55 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
content/en/docs/tutorials/multi-cluster-apps/aggregated-status.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
title: "Checking Aggregated Status" | ||
description: "Aggregating resource status from child clusters" | ||
date: 2022-07-13 | ||
draft: false | ||
weight: 8 | ||
--- | ||
|
||
In Clusternet, you can check the aggregated status of all deployed resources by visiting the status of Subscription. For | ||
every feed/resource, you can check the detailed status (field `feedStatusDetails`) per cluster and the summarized | ||
status (field `feedStatusSummary`) of all clusters in `status.aggregatedStatuses`. | ||
|
||
```yaml | ||
status: | ||
aggregatedStatuses: | ||
- apiVersion: v1 | ||
feedStatusDetails: | ||
- available: true | ||
clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 | ||
clusterName: clusternet-cluster-bb2xp | ||
replicaStatus: { } | ||
- available: true | ||
clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc | ||
clusterName: clusternet-cluster-skxd4 | ||
replicaStatus: { } | ||
feedStatusSummary: | ||
available: true | ||
replicaStatus: { } | ||
kind: Namespace | ||
name: qux | ||
- apiVersion: v1 | ||
feedStatusDetails: | ||
- available: true | ||
clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 | ||
clusterName: clusternet-cluster-bb2xp | ||
replicaStatus: { } | ||
- available: true | ||
clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc | ||
clusterName: clusternet-cluster-skxd4 | ||
replicaStatus: { } | ||
feedStatusSummary: | ||
available: true | ||
replicaStatus: { } | ||
kind: Service | ||
name: my-nginx-svc | ||
namespace: qux | ||
- apiVersion: apps/v1 | ||
feedStatusDetails: | ||
- available: true | ||
clusterId: 851a623b-a38c-42ec-95b5-dbea9ed27116 | ||
clusterName: clusternet-cluster-bb2xp | ||
replicaStatus: | ||
availableReplicas: 1 | ||
observedGeneration: 9 | ||
readyReplicas: 1 | ||
replicas: 1 | ||
updatedReplicas: 1 | ||
- available: true | ||
clusterId: 58602f69-8664-43f5-bbf2-0b20af76b0bc | ||
clusterName: clusternet-cluster-skxd4 | ||
replicaStatus: | ||
availableReplicas: 2 | ||
observedGeneration: 5 | ||
readyReplicas: 2 | ||
replicas: 2 | ||
updatedReplicas: 2 | ||
feedStatusSummary: | ||
available: true | ||
replicaStatus: | ||
availableReplicas: 3 | ||
observedGeneration: 9 | ||
readyReplicas: 3 | ||
replicas: 3 | ||
updatedReplicas: 3 | ||
kind: Deployment | ||
name: my-nginx | ||
namespace: qux | ||
bindingClusters: | ||
- clusternet-v7wzq/clusternet-cluster-bb2xp | ||
- clusternet-wlf5b/clusternet-cluster-skxd4 | ||
desiredReleases: 2 | ||
replicas: | ||
apps/v1/Deployment/qux/my-nginx: | ||
- 1 | ||
- 2 | ||
v1/Namespace/qux: [ ] | ||
v1/Service/qux/my-nginx-svc: [ ] | ||
specHash: 3893382778 | ||
``` | ||
|
||
From above example, we can see Deployment `qux/my-nginx` with total 3 replicas has been deployed to 2 clusters. | ||
From `feedStatusSummary`, we can see total 3 replicas are available and running healthy. |
96 changes: 96 additions & 0 deletions
96
...en/docs/tutorials/multi-cluster-apps/dynamic-scheduling-to-multiple-clusters.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: "Deploying Applications to Multiple Clusters with Dynamic Scheduling" | ||
description: "Scheduling applications of multiple replicas to several clusters by cluster capacity" | ||
date: 2022-07-13 | ||
draft: false | ||
weight: 3 | ||
--- | ||
|
||
This tutorial will walk you through how to deploy applications to multiple clusters with dynamic scheduling. It is | ||
different from static dividing scheduling. When using dynamic scheduling, the replicas of an application will be split | ||
based on cluster capacity. | ||
|
||
## Defining Your Applications | ||
|
||
Let's see an example using dynamic scheduling. Below `Subscription` "dynamic-dividing-scheduling-demo" defines the | ||
target child clusters to be distributed to, and the resources to be deployed with. | ||
|
||
```yaml | ||
# examples/dynamic-dividing-scheduling/subscription.yaml | ||
apiVersion: apps.clusternet.io/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: dynamic-dividing-scheduling-demo | ||
namespace: default | ||
spec: | ||
subscribers: # filter out a set of desired clusters | ||
- clusterAffinity: | ||
matchExpressions: | ||
- key: clusters.clusternet.io/cluster-id | ||
operator: Exists | ||
schedulingStrategy: Dividing | ||
dividingScheduling: | ||
type: Dynamic | ||
dynamicDividing: | ||
strategy: Spread # currently we only support Spread dividing strategy | ||
feeds: # defines all the resources to be deployed with | ||
- apiVersion: v1 | ||
kind: Namespace | ||
name: qux | ||
- apiVersion: v1 | ||
kind: Service | ||
name: my-nginx-svc | ||
namespace: qux | ||
- apiVersion: apps/v1 # with a total of 6 replicas | ||
kind: Deployment | ||
name: my-nginx | ||
namespace: qux | ||
``` | ||
|
||
The `Deployment` qux/my-nginx above will run in a set of clusters with a total of 6 replicas. For example, if we've got | ||
three matching clusters as below. | ||
|
||
- `cluster-01` can run 3 replicas of Deployment `qux/my-nginx` | ||
- `cluster-02` can run 6 replicas of Deployment `qux/my-nginx` | ||
- `cluster-03` can run 9 replicas of Deployment `qux/my-nginx` | ||
|
||
`clusternet-scheduler` will assign replicas to each matching cluster by their capacity. As a result, these three clusters | ||
will run 1, 2, 3 replicas respectively. | ||
|
||
You can get the scheduling result by checking the status of Subscription `dynamic-dividing-scheduling-demo`. | ||
|
||
```yaml | ||
bindingClusters: | ||
- clusternet-v7wzq/clusternet-cluster-bb2xp | ||
- clusternet-wlf5b/clusternet-cluster-skxd4 | ||
- clusternet-bbf20/clusternet-cluster-aqx3b | ||
desiredReleases: 6 | ||
replicas: | ||
apps/v1/Deployment/qux/my-nginx: | ||
- 1 | ||
- 2 | ||
- 3 | ||
v1/Namespace/qux: [] | ||
v1/Service/qux/my-nginx-svc: [] | ||
``` | ||
|
||
If you want to apply overrides per cluster, please | ||
follow [How to Set Overrides in Clusternet](/docs/tutorials/multi-cluster-apps/setting-overrides/). | ||
|
||
## Applying Your Applications | ||
|
||
After installing kubectl plugin [kubectl-clusternet](/docs/kubectl-clusternet/), you could run commands below to | ||
distribute this application to child clusters. | ||
|
||
```bash | ||
$ kubectl clusternet apply -f examples/dynamic-dividing-scheduling/ | ||
namespace/qux created | ||
deployment.apps/my-nginx created | ||
service/my-nginx-svc created | ||
subscription.apps.clusternet.io/dynamic-dividing-scheduling-demo created | ||
$ # or | ||
$ # kubectl-clusternet apply -f examples/dynamic-dividing-scheduling/ | ||
``` | ||
|
||
You can [check aggregated status](docs/tutorials/multi-cluster-apps/aggregated-status/) of feeds/resources running in | ||
each child clusters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.