k8s-helper-cli 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k8s-helper-cli
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A simplified Python wrapper for common Kubernetes operations
5
5
  Author-email: Harshit Chatterjee <harshitchatterjee50@gmail.com>
6
6
  License-Expression: MIT
@@ -16,6 +16,7 @@ Requires-Dist: rich>=13.0.0
16
16
  Requires-Dist: pyyaml>=6.0
17
17
  Requires-Dist: boto3>=1.26.0
18
18
  Requires-Dist: botocore>=1.29.0
19
+ Requires-Dist: requests>=2.20.0
19
20
  Provides-Extra: dev
20
21
  Requires-Dist: pytest>=7.0.0; extra == "dev"
21
22
  Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
@@ -33,12 +34,14 @@ A simplified Python wrapper for common Kubernetes operations that makes it easy
33
34
 
34
35
  - ✅ **Pod Management**: Create, delete, and list pods
35
36
  - ✅ **Deployment Management**: Create, delete, scale, and list deployments with init containers
37
+ - ✅ **Rolling Updates**: Seamless deployment updates with status monitoring
36
38
  - ✅ **Service Management**: Create, delete, list services with URL retrieval
37
39
  - ✅ **AWS EKS Integration**: Create and manage EKS clusters with automatic configuration
38
40
  - ✅ **Secrets Management**: Create, list, and delete Kubernetes secrets
39
41
  - ✅ **Persistent Volume Claims**: Create, list, and delete PVCs with multiple access modes
40
42
  - ✅ **Service URL Discovery**: Get service URLs including AWS ELB DNS names
41
43
  - ✅ **Advanced Deployments**: Support for init containers, volume mounts, and complex configurations
44
+ - ✅ **Monitoring Stack**: One-command setup of Prometheus and Grafana with dashboards
42
45
  - ✅ **Resource Monitoring**: Get logs, events, and resource descriptions
43
46
  - ✅ **Easy Configuration**: Simple configuration management
44
47
  - ✅ **Formatted Output**: Beautiful table, YAML, and JSON output formats
@@ -214,6 +217,60 @@ services = client.list_services()
214
217
  print(format_service_list(services))
215
218
  ```
216
219
 
220
+ ### Monitoring Stack Setup
221
+
222
+ ```python
223
+ # Deploy complete monitoring stack
224
+ result = client.setup_monitoring(
225
+ namespace="monitoring",
226
+ grafana_service_type="NodePort",
227
+ import_dashboard=True,
228
+ wait_for_ready=True
229
+ )
230
+
231
+ if result['success']:
232
+ print("✅ Monitoring stack deployed successfully!")
233
+ print(f"🔑 Grafana credentials: {result['grafana']['admin_user']}/{result['grafana']['admin_password']}")
234
+ else:
235
+ print(f"❌ Deployment failed: {result['error']}")
236
+
237
+ # Get monitoring stack information
238
+ info = client.get_monitoring_info("monitoring")
239
+ print(f"Prometheus running: {info['prometheus']['running']}")
240
+ print(f"Grafana running: {info['grafana']['running']}")
241
+ if info['grafana']['url']:
242
+ print(f"Grafana URL: {info['grafana']['url']}")
243
+ ```
244
+
245
+ ### Prometheus Target Management
246
+
247
+ ```python
248
+ # Add a new monitoring target
249
+ success = client.add_prometheus_target(
250
+ job_name="my-app-metrics",
251
+ targets=["my-app-service:8080", "10.0.1.100:9090"],
252
+ namespace="monitoring",
253
+ metrics_path="/metrics",
254
+ scrape_interval="30s"
255
+ )
256
+
257
+ # List all monitoring targets
258
+ targets_info = client.list_prometheus_targets("monitoring")
259
+ for target in targets_info['targets']:
260
+ print(f"Job: {target['job_name']}, Targets: {target['targets']}")
261
+
262
+ # Update existing target
263
+ client.update_prometheus_target(
264
+ job_name="my-app-metrics",
265
+ targets=["my-app-service:8080", "my-app-service:9090"],
266
+ namespace="monitoring",
267
+ scrape_interval="15s"
268
+ )
269
+
270
+ # Remove monitoring target
271
+ client.remove_prometheus_target("my-app-metrics", "monitoring")
272
+ ```
273
+
217
274
  ### Logs and Events
218
275
 
219
276
  ```python
@@ -604,6 +661,54 @@ k8s-helper list-services --namespace my-namespace
604
661
  k8s-helper list-services --output yaml
605
662
  ```
606
663
 
664
+ ### Monitoring Stack
665
+
666
+ ```bash
667
+ # Deploy complete monitoring stack (Prometheus + Grafana)
668
+ k8s-helper setup-monitoring
669
+
670
+ # Deploy to custom namespace with LoadBalancer service
671
+ k8s-helper setup-monitoring --namespace monitoring --service-type LoadBalancer
672
+
673
+ # Deploy without importing default dashboard
674
+ k8s-helper setup-monitoring --no-dashboard
675
+
676
+ # Check monitoring stack status
677
+ k8s-helper monitoring-status --namespace monitoring
678
+
679
+ # Remove monitoring stack
680
+ k8s-helper delete-monitoring --namespace monitoring
681
+ ```
682
+
683
+ ### Prometheus Target Management
684
+
685
+ ```bash
686
+ # Add a new monitoring target
687
+ k8s-helper add-prometheus-target my-app-metrics "my-app-service:8080,10.0.1.100:9090" --namespace monitoring
688
+
689
+ # Add target with custom configuration
690
+ k8s-helper add-prometheus-target custom-metrics "service:9090" --metrics-path "/custom/metrics" --scrape-interval "30s"
691
+
692
+ # List all monitoring targets
693
+ k8s-helper list-prometheus-targets --namespace monitoring
694
+
695
+ # List targets in different output formats
696
+ k8s-helper list-prometheus-targets --output json
697
+ k8s-helper list-prometheus-targets --output yaml
698
+
699
+ # Update existing target
700
+ k8s-helper update-prometheus-target my-app-metrics "new-service:8080,updated-service:9090" --namespace monitoring
701
+
702
+ # Update target with new configuration
703
+ k8s-helper update-prometheus-target my-app-metrics "service:8080" --metrics-path "/v2/metrics" --scrape-interval "15s"
704
+
705
+ # Remove monitoring target
706
+ k8s-helper remove-prometheus-target my-app-metrics --namespace monitoring
707
+
708
+ # Remove target without confirmation
709
+ k8s-helper remove-prometheus-target my-app-metrics --force
710
+ ```
711
+
607
712
  ### Monitoring and Events
608
713
 
609
714
  ```bash
@@ -6,12 +6,14 @@ A simplified Python wrapper for common Kubernetes operations that makes it easy
6
6
 
7
7
  - ✅ **Pod Management**: Create, delete, and list pods
8
8
  - ✅ **Deployment Management**: Create, delete, scale, and list deployments with init containers
9
+ - ✅ **Rolling Updates**: Seamless deployment updates with status monitoring
9
10
  - ✅ **Service Management**: Create, delete, list services with URL retrieval
10
11
  - ✅ **AWS EKS Integration**: Create and manage EKS clusters with automatic configuration
11
12
  - ✅ **Secrets Management**: Create, list, and delete Kubernetes secrets
12
13
  - ✅ **Persistent Volume Claims**: Create, list, and delete PVCs with multiple access modes
13
14
  - ✅ **Service URL Discovery**: Get service URLs including AWS ELB DNS names
14
15
  - ✅ **Advanced Deployments**: Support for init containers, volume mounts, and complex configurations
16
+ - ✅ **Monitoring Stack**: One-command setup of Prometheus and Grafana with dashboards
15
17
  - ✅ **Resource Monitoring**: Get logs, events, and resource descriptions
16
18
  - ✅ **Easy Configuration**: Simple configuration management
17
19
  - ✅ **Formatted Output**: Beautiful table, YAML, and JSON output formats
@@ -187,6 +189,60 @@ services = client.list_services()
187
189
  print(format_service_list(services))
188
190
  ```
189
191
 
192
+ ### Monitoring Stack Setup
193
+
194
+ ```python
195
+ # Deploy complete monitoring stack
196
+ result = client.setup_monitoring(
197
+ namespace="monitoring",
198
+ grafana_service_type="NodePort",
199
+ import_dashboard=True,
200
+ wait_for_ready=True
201
+ )
202
+
203
+ if result['success']:
204
+ print("✅ Monitoring stack deployed successfully!")
205
+ print(f"🔑 Grafana credentials: {result['grafana']['admin_user']}/{result['grafana']['admin_password']}")
206
+ else:
207
+ print(f"❌ Deployment failed: {result['error']}")
208
+
209
+ # Get monitoring stack information
210
+ info = client.get_monitoring_info("monitoring")
211
+ print(f"Prometheus running: {info['prometheus']['running']}")
212
+ print(f"Grafana running: {info['grafana']['running']}")
213
+ if info['grafana']['url']:
214
+ print(f"Grafana URL: {info['grafana']['url']}")
215
+ ```
216
+
217
+ ### Prometheus Target Management
218
+
219
+ ```python
220
+ # Add a new monitoring target
221
+ success = client.add_prometheus_target(
222
+ job_name="my-app-metrics",
223
+ targets=["my-app-service:8080", "10.0.1.100:9090"],
224
+ namespace="monitoring",
225
+ metrics_path="/metrics",
226
+ scrape_interval="30s"
227
+ )
228
+
229
+ # List all monitoring targets
230
+ targets_info = client.list_prometheus_targets("monitoring")
231
+ for target in targets_info['targets']:
232
+ print(f"Job: {target['job_name']}, Targets: {target['targets']}")
233
+
234
+ # Update existing target
235
+ client.update_prometheus_target(
236
+ job_name="my-app-metrics",
237
+ targets=["my-app-service:8080", "my-app-service:9090"],
238
+ namespace="monitoring",
239
+ scrape_interval="15s"
240
+ )
241
+
242
+ # Remove monitoring target
243
+ client.remove_prometheus_target("my-app-metrics", "monitoring")
244
+ ```
245
+
190
246
  ### Logs and Events
191
247
 
192
248
  ```python
@@ -577,6 +633,54 @@ k8s-helper list-services --namespace my-namespace
577
633
  k8s-helper list-services --output yaml
578
634
  ```
579
635
 
636
+ ### Monitoring Stack
637
+
638
+ ```bash
639
+ # Deploy complete monitoring stack (Prometheus + Grafana)
640
+ k8s-helper setup-monitoring
641
+
642
+ # Deploy to custom namespace with LoadBalancer service
643
+ k8s-helper setup-monitoring --namespace monitoring --service-type LoadBalancer
644
+
645
+ # Deploy without importing default dashboard
646
+ k8s-helper setup-monitoring --no-dashboard
647
+
648
+ # Check monitoring stack status
649
+ k8s-helper monitoring-status --namespace monitoring
650
+
651
+ # Remove monitoring stack
652
+ k8s-helper delete-monitoring --namespace monitoring
653
+ ```
654
+
655
+ ### Prometheus Target Management
656
+
657
+ ```bash
658
+ # Add a new monitoring target
659
+ k8s-helper add-prometheus-target my-app-metrics "my-app-service:8080,10.0.1.100:9090" --namespace monitoring
660
+
661
+ # Add target with custom configuration
662
+ k8s-helper add-prometheus-target custom-metrics "service:9090" --metrics-path "/custom/metrics" --scrape-interval "30s"
663
+
664
+ # List all monitoring targets
665
+ k8s-helper list-prometheus-targets --namespace monitoring
666
+
667
+ # List targets in different output formats
668
+ k8s-helper list-prometheus-targets --output json
669
+ k8s-helper list-prometheus-targets --output yaml
670
+
671
+ # Update existing target
672
+ k8s-helper update-prometheus-target my-app-metrics "new-service:8080,updated-service:9090" --namespace monitoring
673
+
674
+ # Update target with new configuration
675
+ k8s-helper update-prometheus-target my-app-metrics "service:8080" --metrics-path "/v2/metrics" --scrape-interval "15s"
676
+
677
+ # Remove monitoring target
678
+ k8s-helper remove-prometheus-target my-app-metrics --namespace monitoring
679
+
680
+ # Remove target without confirmation
681
+ k8s-helper remove-prometheus-target my-app-metrics --force
682
+ ```
683
+
580
684
  ### Monitoring and Events
581
685
 
582
686
  ```bash
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "k8s-helper-cli"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "A simplified Python wrapper for common Kubernetes operations"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -14,7 +14,8 @@ dependencies = [
14
14
  "rich>=13.0.0", # Pretty terminal output
15
15
  "pyyaml>=6.0", # YAML handling
16
16
  "boto3>=1.26.0", # AWS SDK
17
- "botocore>=1.29.0" # AWS core
17
+ "botocore>=1.29.0", # AWS core
18
+ "requests>=2.20.0" # HTTP requests for Grafana configuration
18
19
  ]
19
20
 
20
21
  [project.optional-dependencies]
@@ -20,7 +20,7 @@ from .utils import (
20
20
  create_service_manifest
21
21
  )
22
22
 
23
- __version__ = "0.3.0"
23
+ __version__ = "0.4.0"
24
24
  __author__ = "Harshit Chatterjee"
25
25
  __email__ = "harshitchatterjee50@gmail.com"
26
26