Working with Kubernetes isn’t always easy. Managing your clusters and pods requires work, and although cloud-hosted Kubernetes instances such as can handle much of the heavy lifting for you, they’re not available if you’re running Kubernetes on-premises or on your own virtual infrastructures.
That’s where comes in to play, as it’s how Kubernetes communicates between components and external controllers. You can use the kubectl command line tools to communicate with the API or use it through familiar REST (Representational State Transfer) calls. The API helps you manage workloads, configure clusters, and manage the behavior of your applications and cluster.
RESTful APIs like this are useful tools, but they require significant development work if you’re building your own controllers. You can remove the associated development overhead by working through one of , which now include . In addition to the official versions, there are unofficial clients, which include two alternative .NET implementations if the official release doesn’t quite fit with how you want to use it.
Introducing the .NET Kubernetes API client library
The is available on GitHub, managed by a team of open source developers that includes Microsoft staff. The current release is 1.6.21, and development is ongoing. You can download the code from GitHub and compile it yourself or add the library to as a package called
KubernetesClient. Once installed, add the library to your code with a using statement that loads the client, as
k8s. The library supports both .NET and .NET Core, so you can use it to write cross-platform apps as well as purely Windows code.