Exploring Pulumi for K8S with Kotlin

Luis Trigueiros
2 min readAug 14, 2022

--

Pulumi is at the moment one of the most interresting infractructure as Code (ie:“IaC”) tools, it is third or fourth generation IaC that builds on the ideas of the previous tools but using existing tested and proven programing languages rather the domain spefic DSL like HCL in Terraform or YAML on the case of Ansible.

The advantage is that allows to leverage existing skills and tooling, for example:

  • languages module systems, like npm, maven, pypi
  • powefull code editors with code autocompletion as you type
  • code scanning and quality tools Sonar

The recent release of Pulumi double down on their mission by rebraning as Universal IaC by adding support of Java, YAML. CUE, addition to the alredy supported 5 or 6 diferent programing languages.

For an excellent introductory video material please check out this video

With the recent announcement of the Java support I decied to give it a go a see if I could use it to automate provisioning of workloads into Kubernetes but using Kotlin because of all it’s moderm features that make it a delightfull language to work with not least of it the support for type safe builders.

Based on the existing Kubernetes Java Quickstart project, I have create Kotlin version of it available at:

Kotlin allow us to write code with low noise to signal ratio where with very very little code once can say or do a lot.

Once you clone this repository and setup a connection to Kubernets you will be able to test it using the Pulumi CLI

For a light local kubernetes that you can setup for testing and prototyping I recomend Kind.

For an interressting article on options for local kubernetes development please refer to this article:

--

--