Home - anongitmous/k8sShell GitHub Wiki

A PowerShell module that is intended to simplify and help in automating day-to-day tasks typically performed using kubectl.exe.

In particular, what is implemented within this module is primarily the 'R' and 'D' from CRUD: Read and Delete.

This is not a replacement for kubectl. The cmdlets that have been implemented are those that I found myself wanting to automate and/or being used with a fair amount of regularity as I monitored and troubleshot various clusters.

The genesis of this was that I was managing a team of engineers and data scientists in a Kubernetes environment and wanted to be able run usage reports, submit bug reports, monitor performance, etc. Although I have written my fair share of DOS bat files over the years, I am far more comfortable with PowerShell than I am with DOS, and I consider the kubectl utility, while amazingly powerful, more akin to a DOS-like utility and I was faced with a choice: write a bunch of .bat files to help me to automate the use of kubectl, or use PowerShell where the mantra is 'objects not text,' and that is the path I originally took.

This particular module arose from having written a variety of fairly elaborate and complicated PowerShell scripts that parsed the text output of kubectl to help in its automation. As they grew in complexity, and I was wanting to e.g. download or display logs from multiple containers in parallel, I was again faced with a dilemma: continue using PowerShell or switch to wrapping the native kubernetes .NET client library in C#. The choice was easy for me because even with the use of Visual Studio Code, writing and debugging PowerShell scripts does not offer the power of writing in C# with Visual Studio.

The vast majority of the cmdlets are written for the purposes of generating reports and querying the state of the cluster and its objects, but not creating or editing them (a notable exception being the ingress cmdlets).

The majority of K8sShell's functionality was developed and tested against AWS Kubernetes clusters, but basic functionality tests have also been done against clusters running on Docker Desktop, Google Cloud, and Microsoft Azure.

PowerShell Gallery