-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from PixelRobots/docs-page-updates
Update usage documentation: Add PowerShell and Krew plugin usage exam…
- Loading branch information
Showing
7 changed files
with
183 additions
and
74 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
title: Usage | ||
parent: Documentation | ||
nav_order: 3 | ||
layout: default | ||
--- | ||
|
||
# Usage | ||
|
||
KubeTidy can be used across different platforms using either PowerShell (Windows/Linux/macOS) or as a `kubectl` plugin via Krew (Linux/macOS). Choose the instructions that match your environment: | ||
|
||
- [PowerShell Usage](docs/powershell-usage) | ||
- [Krew Plugin Usage](docs/krew-usage) | ||
|
||
If you want to see detailed logging examples and summaries, head over to the [Logging and Output](docs/logging-output) page. |
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,59 @@ | ||
--- | ||
title: Krew Plugin Usage | ||
parent: Usage | ||
nav_order: 2 | ||
layout: default | ||
--- | ||
|
||
# Krew Plugin Usage | ||
|
||
If you're using **KubeTidy** via Krew as a `kubectl` plugin (Linux/macOS), here are the usage examples to help you manage your `kubeconfig` files. | ||
|
||
## Clean Up Unreachable Clusters | ||
|
||
To clean up unreachable clusters from your `kubeconfig`, use the following command: | ||
|
||
```bash | ||
kubectl kubetidy -kubeconfig "$HOME/.kube/config" -exclusionlist "cluster1,cluster2" | ||
``` | ||
|
||
## Merging Kubeconfig Files | ||
|
||
To merge multiple `kubeconfig` files into a single one: | ||
|
||
```bash | ||
kubectl kubetidy -mergeconfigs "config1.yaml" "config2.yaml" -destinationconfig "$HOME/.kube/config" | ||
``` | ||
|
||
## Listing Clusters | ||
|
||
To list all clusters in your `kubeconfig` without making changes: | ||
|
||
```bash | ||
kubectl kubetidy -kubeconfig "$HOME/.kube/config" -listclusters | ||
``` | ||
|
||
## Listing Contexts | ||
|
||
To list all contexts in your `kubeconfig`: | ||
|
||
```bash | ||
kubectl kubetidy -kubeconfig "$HOME/.kube/config" -listcontexts | ||
``` | ||
|
||
## Dry Run Mode | ||
|
||
Use the `-dryrun` option to simulate the cleanup process without modifying your `kubeconfig`: | ||
|
||
```bash | ||
kubectl kubetidy -kubeconfig "$HOME/.kube/config" -exclusionlist "cluster1" -dryrun | ||
``` | ||
|
||
The Dry Run Mode also works for merging multiple kubeconfig files. This allows you to preview a summary of the merge without making any actual changes to the destination file. | ||
|
||
```bash | ||
kubectl kubetidy -mergeconfigs "config1.yaml" "config2.yaml" -destinationconfig "$HOME/.kube/config" -dryrun | ||
``` | ||
|
||
|
||
For detailed logging examples, check out our [Logging and Output](docs/logging-output) page. |
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,44 @@ | ||
--- | ||
title: Logging and Output | ||
parent: Usage | ||
nav_order: 3 | ||
layout: default | ||
--- | ||
|
||
# Logging and Output | ||
|
||
KubeTidy provides detailed output and logging for each operation. You can use the `-Verbose` flag to see detailed information about cluster reachability, user and context removal, and more. | ||
|
||
## Verbose Logging Example | ||
|
||
Use the `-Verbose` flag for detailed logging during the cleanup process: | ||
|
||
```powershell | ||
Invoke-KubeTidy -KubeConfigPath "$HOME\.kube\config" -Verbose | ||
``` | ||
|
||
### Verbose Output Example | ||
|
||
``` | ||
VERBOSE: Checking reachability for cluster: aks-prod-cluster at https://example-cluster-url | ||
VERBOSE: Cluster aks-prod-cluster is reachable via HTTPS. | ||
VERBOSE: Removing unreachable cluster: aks-old-cluster | ||
VERBOSE: Removed associated user: aks-old-user | ||
VERBOSE: Backup of kubeconfig created: C:\Users\username\.kube\config.backup | ||
``` | ||
|
||
## Summary Output | ||
|
||
After running KubeTidy, a summary is displayed showing how many clusters were checked, removed, or retained: | ||
|
||
``` | ||
╔════════════════════════════════════════════════╗ | ||
║ KubeTidy Summary ║ | ||
╠════════════════════════════════════════════════╣ | ||
║ Clusters Checked: 26 ║ | ||
║ Clusters Removed: 2 ║ | ||
║ Clusters Kept: 24 ║ | ||
╚════════════════════════════════════════════════╝ | ||
``` | ||
|
||
![KubeTidy Cleanup Summary](../../assets/images/summary.png) |
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,58 @@ | ||
--- | ||
title: PowerShell Usage | ||
parent: Usage | ||
nav_order: 1 | ||
layout: default | ||
--- | ||
|
||
# PowerShell Usage | ||
|
||
If you're using **KubeTidy** via PowerShell, here are the usage examples to help you clean up or manage your `kubeconfig` files. | ||
|
||
## Clean Up Unreachable Clusters | ||
|
||
To remove unreachable clusters from your `kubeconfig`, use the following command: | ||
|
||
```powershell | ||
Invoke-KubeTidy -KubeConfigPath "$HOME\.kube\config" -ExclusionList "cluster1,cluster2" | ||
``` | ||
|
||
## Merging Kubeconfig Files | ||
|
||
To merge multiple `kubeconfig` files into a single file: | ||
|
||
```powershell | ||
Invoke-KubeTidy -MergeConfigs "config1.yaml","config2.yaml" -DestinationConfig "$HOME\.kube\config" | ||
``` | ||
|
||
## Listing Clusters | ||
|
||
To list all clusters in your `kubeconfig` without making any changes: | ||
|
||
```powershell | ||
Invoke-KubeTidy -KubeConfigPath "$HOME\.kube\config" -ListClusters | ||
``` | ||
|
||
## Listing Contexts | ||
|
||
To list all contexts in your `kubeconfig`: | ||
|
||
```powershell | ||
Invoke-KubeTidy -KubeConfigPath "$HOME\.kube\config" -ListContexts | ||
``` | ||
|
||
## Dry Run Mode | ||
|
||
Use the `-DryRun` option to simulate the cleanup process without modifying your `kubeconfig`: | ||
|
||
```powershell | ||
Invoke-KubeTidy -KubeConfigPath "$HOME\.kube\config" -ExclusionList "cluster1" -DryRun | ||
``` | ||
|
||
The Dry Run Mode also works for merging multiple kubeconfig files. This allows you to preview a summary of the merge without making any actual changes to the destination file. | ||
|
||
```PowerShell | ||
Invoke-KubeTidy -MergeConfigs "config1.yaml","config2.yaml" -DestinationConfig "$HOME\\.kube\\config" -DryRun | ||
``` | ||
|
||
For detailed logging examples, check out our [Logging and Output](docs/logging-output) page. |
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