-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleksandr Tymchyshyn
committed
Jun 14, 2020
1 parent
0f3310e
commit 6ce7c61
Showing
14 changed files
with
492 additions
and
388 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,66 +1,91 @@ | ||
# Kubectl Aggregate | ||
|
||
![](https://github.com/daftping/kubeagg/workflows/Go/badge.svg) ![Release](https://github.com/daftping/kubeagg/workflows/Release/badge.svg) | ||
|
||
Kubectl wrapper to run against multiple contexts. | ||
Kubectl wrapper to run against multiple contexts and namespaces. | ||
|
||
kubeagg features which are not available in kubectl: | ||
- provide multiple context (literally or as pattern) | ||
|
||
- get objects from multiple context (as list or as pattern) | ||
- get objects from multiple namespaces (as list or as pattern) | ||
|
||
## Usage | ||
|
||
# Usage | ||
```bash | ||
Kubectl wrapper to run against multiple contexts | ||
Kubectl wrapper can get any objects in any cluster in any namespace. | ||
|
||
You can provide list of contexts or context-pattern (regexp) | ||
If object you are trying to get namespaced you can provide list of | ||
namespaces or namespace-pattern (regexp) | ||
|
||
Usage: | ||
kubeagg get [flags] | ||
kubeagg [command] | ||
|
||
Examples: | ||
// Get namespaces from all contexts in (kubectl config view) | ||
kubeagg get ns | ||
|
||
// Get pods from contexts matched 'dev$|test$' regexp and in | ||
// namespaces matched 'default|test|dev' regexp | ||
kubeagg \ | ||
--context-pattern='dev$|test$' \ | ||
--namespace-pattern='default|test|dev' \ | ||
get pod | ||
|
||
// Get all nodes in "docker-desktop" and "test" contexts | ||
kubeagg --contexts=docker-desktop,test get no | ||
|
||
Available Commands: | ||
get Kubectl wrapper to run against multiple contexts and namespaces | ||
help Help about any command | ||
|
||
Flags: | ||
-p, --context-pattern string Send request to contexts matched provided regexp. Ignored if --contexts is provided. (default ".*") | ||
-c, --contexts strings Send request to provided contexts. Has precedence over --context-pattern.(default: '', --context-pattern is used) | ||
-h, --help help for get | ||
-n, --namespace string Namespace to operate in. (default "default") | ||
-o, --output string Output format. Supported values: table, wide, json. (default "table") | ||
|
||
Global Flags: | ||
-l, --loglevel string Debug, Info, Warn, Error, Fatal (default "Error") | ||
--context-pattern string Send request to contexts matched provided regexp. | ||
Ignored if --contexts is provided. (default ".*") | ||
--contexts strings Send request to provided contexts. Has precedence over --context-pattern. | ||
(default: '', --context-pattern is used) | ||
-h, --help help for kubeagg | ||
-l, --loglevel string Debug, Info, Warn, Error, Fatal (default "Error") | ||
--namespace-pattern string Get objects from namespaces matched provided regexp. | ||
Ignored if --namespaces is provided. (default ".*") | ||
-n, --namespaces strings List namespaces to get objects from.(default: '', --namespace-pattern is used) | ||
--no-headers Skip headers in output | ||
-o, --output string Output format. Supported values: table, json. (default "table") | ||
|
||
Use "kubeagg [command] --help" for more information about a command. | ||
``` | ||
## All contexts in ~/.kube/config | ||
## Get namespaces in all contexts in ~/.kube/config | ||
```bash | ||
kubeagg get ns | ||
CONTEXT NAME | ||
prod-a default | ||
prod-a kube-public | ||
prod-a kube-system | ||
test-a default | ||
test-a kube-public | ||
test-a kube-system | ||
test-b default | ||
test-b kube-public | ||
test-b kube-system | ||
test-c default | ||
test-c kube-public | ||
test-c kube-system | ||
``` | ||
## List of selected namespaces | ||
```bash | ||
kubeagg get ns --contexts=test-a,test-b -o wide | ||
CONTEXT TYPE NAME | ||
test-a ns default | ||
test-a ns kube-public | ||
test-a ns kube-system | ||
test-b ns default | ||
test-b ns kube-public | ||
test-b ns kube-system | ||
CONTEXT NAMESPACE TYPE NAME | ||
docker-desktop n\a Namespace default | ||
docker-desktop n\a Namespace docker | ||
docker-desktop n\a Namespace kube-node-lease | ||
docker-desktop n\a Namespace kube-public | ||
docker-desktop n\a Namespace kube-system | ||
prod-a n\a Namespace default | ||
prod-a n\a Namespace kube-public | ||
prod-a n\a Namespace kube-system | ||
test-a n\a Namespace default | ||
test-a n\a Namespace kube-public | ||
test-a n\a Namespace kube-system | ||
test-b n\a Namespace default | ||
test-b n\a Namespace kube-public | ||
test-b n\a Namespace kube-system | ||
``` | ||
## Regexp matched deployments | ||
```bash | ||
kubeagg get deploy --context-pattern='test-[b|c]$' --namespace=kube-system -o wide | ||
CONTEXT TYPE NAME | ||
test-b deploy cluster-autoscaler | ||
test-b deploy kube-dns | ||
test-b deploy metrics-server | ||
test-c deploy cluster-autoscaler | ||
test-c deploy kube-dns | ||
test-c deploy metrics-server | ||
## Get pod from contexts matched pattern and namespaces matched pattern | ||
```bash | ||
kubeagg \ | ||
--context-pattern='^docker-desktop$|^test' \ | ||
--namespace-pattern='default|-public$' \ | ||
get pod | ||
CONTEXT NAMESPACE TYPE NAME | ||
docker-desktop default Pod kubeagg | ||
docker-desktop default Pod kubeagg-68898df575-hcvs5 | ||
test-a default Pod kubeagg2 | ||
test-a kube-public Pod kubeagg3 | ||
``` |
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.