From 1b90819fdc887660a9359bd9cf0e5e7d7ba87215 Mon Sep 17 00:00:00 2001 From: yeyeye2333 <3229833855@qq.com> Date: Wed, 28 Aug 2024 15:11:51 +0800 Subject: [PATCH] Doc:Single cluster deployment application (#684) * Doc:Single cluster deployment application Signed-off-by: yeyeye2333 <3229833855@qq.com> * Update docs/content/en/docs/fleet-manager/application.md Signed-off-by: yeyeye2333 <3229833855@qq.com> --------- Signed-off-by: yeyeye2333 <3229833855@qq.com> --- .../en/docs/fleet-manager/application.md | 56 ++++++++++++++++++- ...repo-kustomization-demo-without-fleet.yaml | 2 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/docs/content/en/docs/fleet-manager/application.md b/docs/content/en/docs/fleet-manager/application.md index 0a074c2a..975c99d4 100644 --- a/docs/content/en/docs/fleet-manager/application.md +++ b/docs/content/en/docs/fleet-manager/application.md @@ -213,7 +213,7 @@ Labels such as `env=dev` can be assigned to clusters, and the same selectors can Please note the following considerations: -1. You have the option to set a default selector for all policies under `application.spec.destination`, or to configure it within individual policies. Kurator gives precedence to the policy-level setting - it resorts to the default setting only when the destination within the policy is not set. +1. You have the option to set a default selector for all policies under `application.spec.destination`, or to configure it within individual policies. Kurator gives precedence to the policy-level setting - it resorts to the default setting only when the destination within the policy is not set.And when both `application.spec.destination` and `application.spec.destination[].destination` are empty, it will be [deployed directly in the cluster where kurator resides](/docs/fleet-manager/application/#deployment-application-in-single-cluster). 1. To ensure that the policy functions as expected, selectors should be added to the cluster prior to running the application. @@ -247,6 +247,60 @@ kubectl get po -A --kubeconfig=/root/.kube/kurator-member2.config Upon examining the respective clusters, you'll find that applications originating from the same source configuration have been distributed to different clusters based on their respective policy selector labels. +## Deploy Application in Host Cluster + +Use the following command to deploy the example application that doesn't specify an `ApplicationDestination`. This configuration allows the application to be deployed directly in the cluster where kurator resides, providing a simpler deployment approach for scenarios where multi-cluster management is unnecessary. + +```bash +kubectl apply -f examples/application/gitrepo-kustomization-demo-without-fleet.yaml +``` + +Here is the configuration of the example application. This YAML outlines the source and synchronization policies without `destination`, allowing for deployment in a single cluster. + +```yaml +apiVersion: apps.kurator.dev/v1alpha1 +kind: Application +metadata: + name: without-fleet-demo + namespace: default +spec: + source: + gitRepository: + interval: 3m0s + ref: + branch: master + timeout: 1m0s + url: https://github.com/stefanprodan/podinfo + syncPolicies: + - kustomization: + interval: 0s + path: ./deploy/webapp + prune: true + timeout: 2m0s + - kustomization: + targetNamespace: default + interval: 5m0s + path: ./kustomize + prune: true + timeout: 2m0s +``` + +Verify that the resources are running in the cluster by using the following command: + +```bash +kubectl get po -A +``` + +This command lists all the pods running in the cluster. You should see the pods specified in your application's configuration. + +Currently, when you edit the destination configuration to change the application deployment to fleet, the resources deployed to the cluster where kurator is located will not be deleted. + +Before deploying a new application with a destination, Use the following command to remove the application and its related resources: + +```bash +kubectl delete applications.apps.kurator.dev without-fleet-demo +``` + ## Playground Kurator uses killercoda to provide [applications demo](https://killercoda.com/965010e0-4f60-4a28-bf27-597d3kurator/scenario/application-example), allowing users to experience hands-on operations. diff --git a/examples/application/gitrepo-kustomization-demo-without-fleet.yaml b/examples/application/gitrepo-kustomization-demo-without-fleet.yaml index 6eddb6b2..6e0b94a7 100644 --- a/examples/application/gitrepo-kustomization-demo-without-fleet.yaml +++ b/examples/application/gitrepo-kustomization-demo-without-fleet.yaml @@ -1,7 +1,7 @@ apiVersion: apps.kurator.dev/v1alpha1 kind: Application metadata: - name: rollout-demo + name: without-fleet-demo namespace: default spec: source: