diff --git a/docs/proposal/Configuration-of-karmada-components/README.md b/docs/proposal/Configuration-of-karmada-components/README.md new file mode 100644 index 00000000..025e547d --- /dev/null +++ b/docs/proposal/Configuration-of-karmada-components/README.md @@ -0,0 +1,228 @@ +--- +title: @axif0 +authors: +- "@robot" # Authors' github accounts here. +reviewers: +- "@robot" +- TBD +approvers: +- "@robot" +- TBD + +creation-date: 2024-08-12 + +--- + +# Configuration of karmada components + + + +## Summary + + +To streamline the explanation of Karmada's role in managing multi-cluster Kubernetes environments, Karmada simplifies managing cloud-native applications across multiple Kubernetes clusters and clouds without altering the applications themselves. + +This approach ensures seamless integration with existing Kubernetes tools and avoids vendor lock-in, making it a versatile choice for organizations looking to optimize their Kubernetes deployments across various environments. +## Motivation + + +The motivation behind this project seems to be providing an easy-to-use interface for monitoring and managing Kubernetes deployments, specifically tailored for environments where applications are deployed using Karmada, a Kubernetes-native multi-cluster management system. The dashboard simplifies common tasks such as checking deployment health, restarting deployments, viewing pod logs or editing components raw manifest which can be crucial for maintaining the stability and performance of applications running in Kubernetes clusters. + + +### Goals + + + +- `Listing Running Applications` which fetches and displays the names of applications currently running in the Kubernetes cluster. +- `Fetching Pod Metadata` where given an app label, it retrieves metadata about the pods associated with that app. +- Allows checking the `status of a specific deployment`, indicating whether it has been fully deployed. +- `Restarting Deployments` provides functionality to restart a given deployment. +- `Deleting Pods` Offers the ability to delete a specific pod. +- `Retrieving Pod Logs` Fetches and displays the logs for a specified pod. +- `edit the components' raw manifest` + +### Non-Goals + + + +## Proposal + + + +### User Stories (Optional) + + + +#### Story 1 + +Interacting to the systems Architect, dashboard users want to integrate Karmada with existing CI/CD pipelines to automate deployments and updates across multiple clusters. Users can monitor and troubleshoot deployments across clusters from a central dashboard. Also can update the applications. + + +### Notes/Constraints/Caveats (Optional) + + + +### Risks and Mitigations + + + +## Design Details + + + ![alt text](details.png) +### Karmada Management API + +```markdown +This API provides a set of endpoints for managing and monitoring Karmada components in the `karmada-system` namespace. The API translates requests into corresponding Kubernetes commands, enabling automation and integration with other tools or interfaces. +``` +### API Endpoints + +### 1. Get Running Pods + +- **Command**: + ```bash + kubectl --kubeconfig $KUBECONFIG --context karmada-host -n karmada-system get pods -o json + ``` +- **API**: `/config/running-pods` +- **Purpose**: Fetches an overview of all running Karmada components, including metadata such as UID, creation timestamp, name, etc. + +### 2. Get Pod Metadata + +- **Command**: + ```bash + kubectl --kubeconfig $KUBECONFIG --context karmada-host -n karmada-system get pods -o json + ``` +- **API**: `/config/apps/:appLabel` +- **Purpose**: Provides logs from a specified Karmada pod for debugging or monitoring purposes. + +### 3. Fetch Logs + +- **Command**: + ```bash + kubectl --kubeconfig $KUBECONFIG --context karmada-host -n karmada-system logs {pod_name} + ``` +- **API**: `/config/log/{pod_name}` +- **Purpose**: Provides logs from a specified Karmada pod for debugging or monitoring purposes. + +### 4. Restart Deployment + +- **Command**: + ```bash + kubectl --kubeconfig $KUBECONFIG --context karmada-host -n karmada-system rollout restart deployment/{app_name} + ``` +- **API**: `/config/restart/{app_name}` +- **Purpose**: Restarts the specified Karmada component to apply updates or recover from issues. + +### 5. Check Deployment Status + +- **Command**: + ```bash + kubectl --kubeconfig $KUBECONFIG --context karmada-host -n karmada-system rollout status deployment/{app_name} + ``` +- **API**: `/cluster/status/{app_name}` +- **Purpose**: Monitors the rollout status of a Karmada deployment to ensure it is running correctly. + +### 6. Reinstall Pod + +- **Command**: + ```bash + kubectl --kubeconfig $KUBECONFIG --context karmada-host -n karmada-system delete pod {pod_name} + ``` +- **API**: `/config/reinstall/{pod_name}` +- **Purpose**: Deletes a specific Karmada pod, which will typically result in its automatic recreation. + +## How to Use + +Each of the API endpoints corresponds to a specific Kubernetes command used to manage Karmada components. The API can be integrated into your automation tools or used manually via `curl` commands to interact with the Karmada system. + +### Example Usage + +```bash +# Get running pods +curl http://localhost:8000/api/v1/config/running-pods + +curl http://localhost:8000/api/v1/config/apps/karmada-webhook + +# Fetch logs of a specific pod +curl http://localhost:8000/api/v1/config/log/karmada-webhook-5cbd5f8f46-ljqjq + +# Restart a specific app deployment +curl http://localhost:8000/api/v1/config/restart/karmada-aggregated-apiserver + +# Check deployment status +curl http://localhost:8000/api/v1/config/status/karmada-scheduler-estimator-member2 + +# Reinstall (delete) a specific pod +curl http://localhost:8000/api/v1/config/reinstall/karmada-webhook-5cbd5f8f46-642bg +``` + + +# Frontend Changes + +## Check Status & logs + +![alt text](status.png) + + +## reinstall +![alt text](reinstall.png) + +## restart +![alt text](restart.png) + +## Update + +![alt text](update.png) + + +### Test Plan + +## Alternatives \ No newline at end of file diff --git a/docs/proposal/Configuration-of-karmada-components/details.png b/docs/proposal/Configuration-of-karmada-components/details.png new file mode 100644 index 00000000..e23e3b6c Binary files /dev/null and b/docs/proposal/Configuration-of-karmada-components/details.png differ diff --git a/docs/proposal/Configuration-of-karmada-components/reinstall.png b/docs/proposal/Configuration-of-karmada-components/reinstall.png new file mode 100644 index 00000000..559ebc82 Binary files /dev/null and b/docs/proposal/Configuration-of-karmada-components/reinstall.png differ diff --git a/docs/proposal/Configuration-of-karmada-components/restart.png b/docs/proposal/Configuration-of-karmada-components/restart.png new file mode 100644 index 00000000..6e86626c Binary files /dev/null and b/docs/proposal/Configuration-of-karmada-components/restart.png differ diff --git a/docs/proposal/Configuration-of-karmada-components/status.png b/docs/proposal/Configuration-of-karmada-components/status.png new file mode 100644 index 00000000..fcf29635 Binary files /dev/null and b/docs/proposal/Configuration-of-karmada-components/status.png differ diff --git a/docs/proposal/Configuration-of-karmada-components/update.png b/docs/proposal/Configuration-of-karmada-components/update.png new file mode 100644 index 00000000..a9a3a6f9 Binary files /dev/null and b/docs/proposal/Configuration-of-karmada-components/update.png differ