4. Pulumi for Kubernetes

Kubernetes

In this chapter you use Pulumi’s Kubernetes provider to deploy platform services onto the AKS cluster provisioned in Chapter 3. Instead of running kubectl apply or helm install by hand, every cluster resource is declared in Python and managed through the same pulumi up workflow you already know.

Provider Package

PackagePyPI nameWhat it manages
pulumi-kubernetespulumi_kubernetesAny Kubernetes resource — manifests, Helm releases

The provider connects to the cluster through a kubeconfig. For the AKS cluster created in Chapter 3, Pulumi reads the kubeconfig directly from the KubernetesCluster output — no manual az aks get-credentials step is required:

import pulumi_kubernetes as k8s

k8s_provider = k8s.Provider(
    "k8s-provider",
    kubeconfig=cluster.kube_config_raw
)

Pass this provider explicitly to every Kubernetes resource with opts=pulumi.ResourceOptions(provider=k8s_provider).

Helm Releases via Pulumi

The Kubernetes provider includes a helm.v3.Release resource that wraps helm install / helm upgrade. You declare the chart name, repository URL, target namespace, and values — all in Python. Pulumi tracks the release in state and performs helm upgrade or helm uninstall on subsequent runs, just like any other resource.

What We Deploy

ServiceHelm chartRole
TraefiktraefikIngress controller — routes external traffic into the cluster
Cert-Managercert-managerAutomates TLS certificate issuance via Let’s Encrypt

Pulumi Kubernetes Provider

Kubernetes

Platform Services