Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Actions Status Slack NPM version Python version GoDoc License

Pulumi Kubernetes Resource Provider

The Kubernetes resource provider for Pulumi lets you create, deploy, and manage Kubernetes API resources and workloads in a running cluster. For a streamlined Pulumi walkthrough, including language runtime installation and Kubernetes configuration, select "Get Started" below.

Introduction

pulumi-kubernetes provides an SDK to create any of the API resources available in Kubernetes.

This includes the resources you know and love, such as:

  • Deployments
  • ReplicaSets
  • ConfigMaps
  • Secrets
  • Jobs etc.

Kubernetes API Version Support

The pulumi-kubernetes SDK closely tracks the latest upstream release, and provides access to the full API surface, including deprecated endpoints. The SDK API is 100% compatible with the Kubernetes API, and is schematically identical to what Kubernetes users expect.

We support Kubernetes clusters with version >=1.13.0.

How does API support for Kubernetes work?

Pulumi’s Kubernetes SDK is manufactured by automatically wrapping our library functionality around the Kubernetes resource OpenAPI spec as soon as a new version is released! Ultimately, this means that Pulumi users do not have to learn a new Kubernetes API model, nor wait long to work with the latest available versions.

Note: Pulumi also supports alpha and beta APIs.

Visit the FAQ for more details.

References

Prerequisites

  1. Install Pulumi.
  2. Install a language runtime such as Node.js, Python or .NET.
  3. Install a package manager
    • For Node.js, use NPM or Yarn.
    • For Python, use pip.
    • For .NET, use Nuget which is integrated with the dotnet CLI.
  4. Have access to a running Kubernetes cluster
    • If kubectl already works for your running cluster, Pulumi respects and uses this configuration.
    • If you do not have a cluster already running and available, we encourage you to explore Pulumi's SDKs for AWS EKS, Azure AKS, and GCP GKE. Visit the API reference docs in the Pulumi Registry for more details.
  5. Install kubectl.

Installing

This package is available in many languages in the standard packaging formats.

For Node.js use either npm or yarn:

npm:

npm install @pulumi/kubernetes

yarn:

yarn add @pulumi/kubernetes

For Python use pip:

pip install pulumi-kubernetes

For .NET, dependencies will be automatically installed as part of your Pulumi deployments using dotnet build.

To use from Go, use go install to grab the latest version of the library

$ go install github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes@latest

Quick Examples

The following examples demonstrate how to work with pulumi-kubernetes in a couple of ways.

Examples may include the creation of an AWS EKS cluster, although an EKS cluster is not required to use pulumi/kubernetes. It is simply used to ensure we have access to a running Kubernetes cluster to deploy resources and workloads into.

Deploying a YAML Manifest

This example deploys resources from a YAML manifest file path, using the transient, default kubeconfig credentials on the local machine, just as kubectl does.

import * as k8s from "@pulumi/kubernetes";

const myApp = new k8s.yaml.ConfigFile("app", {
    file: "app.yaml"
});

Deploying a Helm Chart

This example creates an EKS cluster with pulumi/eks, and then deploys a WordPress Helm chart from Bitnami's OCI registry using the kubeconfig credentials from the cluster's Pulumi provider.

import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";

// Create an EKS cluster.
const cluster = new eks.Cluster("my-cluster");

// Deploy Wordpress into our cluster.
const wordpress = new k8s.helm.v3.Chart("wordpress", {
    chart: "oci://registry-1.docker.io/bitnamicharts/wordpress",
    values: {
        wordpressBlogName: "My Cool Kubernetes Blog!",
    },
}, { providers: { "kubernetes": cluster.provider } });

// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;

Deploying a Workload using the Resource API

This example creates a EKS cluster with pulumi/eks, and then deploys an NGINX Deployment and Service using the SDK resource API, and the kubeconfig credentials from the cluster's Pulumi provider.

import * as eks from "@pulumi/eks";
import * as k8s from "@pulumi/kubernetes";

// Create an EKS cluster with the default configuration.
const cluster = new eks.Cluster("my-cluster");

// Create a NGINX Deployment and Service.
const appName = "my-app";
const appLabels = { appClass: appName };
const deployment = new k8s.apps.v1.Deployment(`${appName}-dep`, {
    metadata: { labels: appLabels },
    spec: {
        replicas: 2,
        selector: { matchLabels: appLabels },
        template: {
            metadata: { labels: appLabels },
            spec: {
                containers: [{
                    name: appName,
                    image: "nginx",
                    ports: [{ name: "http", containerPort: 80 }]
                }],
            }
        }
    },
}, { provider: cluster.provider });

const service = new k8s.core.v1.Service(`${appName}-svc`, {
    metadata: { labels: appLabels },
    spec: {
        type: "LoadBalancer",
        ports: [{ port: 80, targetPort: "http" }],
        selector: appLabels,
    },
}, { provider: cluster.provider });

// Export the URL for the load balanced service.
export const url = service.status.loadBalancer.ingress[0].hostname;

// Export the cluster's kubeconfig.
export const kubeconfig = cluster.kubeconfig;

Contributing

If you are interested in contributing, please see the contributing docs.

Code of Conduct

You can read the code of conduct here.

Metadata

Release files for pulumi-kubernetes 4.33.0a1783149451

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pulumi-kubernetes 4.33.0a1783149451
File Size Uploaded Provenance Actions
pulumi_kubernetes-4.33.0a1783149451.tar.gz 2.0 MB Without provenance Details for pulumi_kubernetes-4.33.0a1783149451.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pulumi-kubernetes 4.33.0a1783149451
File Interpreter ABI Platform Actions
pulumi_kubernetes-4.33.0a1783149451-py3-none-any.whl Python 3 none any Details for pulumi_kubernetes-4.33.0a1783149451-py3-none-any.whl

Total release size: 5.1 MB

Release files / pulumi_kubernetes-4.33.0a1783149451.tar.gz

Download URL pulumi_kubernetes-4.33.0a1783149451.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
534bb7eeeabe779f275d29a21cdfca4710927466771bab41b428a0b7b178c697
BLAKE2b-256 checksum
How to use checksums
799f4cd1b6b5a13f47b481f1986207fff3830001aafae6978552f76c6e15b481
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / pulumi_kubernetes-4.33.0a1783149451-py3-none-any.whl

Download URL pulumi_kubernetes-4.33.0a1783149451-py3-none-any.whl
Size 3.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5d14603effaf087dca958f6e20809581cb1db1fd524b9e299be6a3adaf286c86
BLAKE2b-256 checksum
How to use checksums
c816befbcae2f7177ea3b92d98a6384f80a2f0542d2a68fc114bfb38c2b41f5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Security for pulumi-kubernetes 4.33.0a1783149451

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page