Pulumi Converter Kubernetes banner
pulumi pulumi

Pulumi Converter Kubernetes

DevOps community

Description

A Pulumi converter plugin to convert kubernetes manifests to Pulumi languages.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

pulumi-converter-kubernetes

The Pulumi Converter Kubernetes plugin facilitates the conversion of Kubernetes manifests into Pulumi languages, enhancing your Kubernetes development workflow. By leveraging strong types, compilation errors, and comprehensive IDE support, such as autocomplete, you can effectively declare and manage infrastructure across various clouds within the same program that handles your Kubernetes resources.

This converter supersedes [kube2pulumi](https://github.com/pulumi/kube2pulumi).

Prerequisites

Installation

Install the plugin using the following command:

pulumi plugin install converter kubernetes

Usage

Execute the following command within the directory containing your Kubernetes manifests:

pulumi convert --from kubernetes --language  --out 

This command converts Kubernetes code into your preferred language: `typescript`, `csharp`, `python`, `go`, `java` or `yaml`

Component Mode

You can output every kubernetes resource as a Pulumi component resource specifying the `--component-mode` flag:

pulumi convert --from kubernetes --language  --out  -- --component-mode

Example

Let's convert a simple YAML file describing a pod with a single container running nginx:

apiVersion: v1
kind: Pod
metadata:
  namespace: foo
  name: bar
spec:
  containers:
    - name: nginx
      image: nginx:1.14-alpine
      resources:
        limits:
          memory: 20Mi
          cpu: 0.2

Go

pulumi convert --from kubernetes --language go --out program
// ./pulumi/main.go
package main

import (
	corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1"
	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) e