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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulumi_kubernetes-4.34.0a1787358163.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pulumi_kubernetes-4.34.0a1787358163-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file pulumi_kubernetes-4.34.0a1787358163.tar.gz.

File metadata

File hashes

Hashes for pulumi_kubernetes-4.34.0a1787358163.tar.gz
Algorithm Hash digest
SHA256 bf1c717f3bd04d015d537abb347c7552c475a6c7b3962f7d72adb6ce261be651
MD5 059d44cc778211ce57762d7f0dc319a1
BLAKE2b-256 2c248621f9c0848ce4987f51599c258249a090a85b8c3cfa72d7e4dcb1674a5f

See more details on using hashes here.

File details

Details for the file pulumi_kubernetes-4.34.0a1787358163-py3-none-any.whl.

File metadata

File hashes

Hashes for pulumi_kubernetes-4.34.0a1787358163-py3-none-any.whl
Algorithm Hash digest
SHA256 ae547876f99b12d36686e3c0a2a4fad16bd5a502ae168a19a05826feda9a45fa
MD5 683741fa965b64c71f1779db404f9443
BLAKE2b-256 7e6f0bb0374ab5c570216436689d69fe51c00eb4f51db049c97c1b535362b363

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.34.0a1787358163 This release

2 files

4.33.0

2 files

4.32.0

2 files

4.31.1

2 files

4.31.0

2 files

4.30.0

2 files

4.29.0

2 files

4.28.0

2 files

4.27.0

2 files

4.26.0

2 files

4.25.0

2 files

4.24.1

2 files

4.24.0

2 files

4.23.0

2 files

4.22.2

2 files

4.22.1

2 files

4.22.0

2 files

4.21.1

2 files

4.21.0

2 files

4.20.0

2 files

4.19.0

2 files

4.18.4

2 files

4.18.3

2 files

4.18.2

2 files

4.18.1

2 files

4.18.0

2 files

4.17.1

2 files

4.17.0

2 files

4.16.0

2 files

4.15.0

2 files

4.14.0

2 files

4.13.1

2 files

4.12.0

2 files

4.11.0

2 files

4.10.0

2 files

4.9.1

2 files

4.9.0

2 files

4.8.1

2 files

4.8.0

2 files

4.7.1

2 files

4.7.0

2 files

4.6.1

2 files

4.6.0

2 files

4.5.6

2 files

4.5.5

2 files

4.5.4

2 files

4.5.3

2 files

4.5.2

2 files

4.5.1

2 files

4.5.0

2 files

4.4.0

2 files

4.3.0

2 files

4.2.0

2 files

4.1.1

1 file

4.1.0

1 file

4.0.3

1 file

4.0.2

1 file

4.0.1

1 file

4.0.0

1 file

3.30.2

1 file

3.30.1

1 file

3.30.0

1 file

3.29.1

1 file

3.29.0

1 file

3.28.1

1 file

3.28.0

1 file

3.27.1

1 file

3.27.0

1 file

3.26.0

1 file

3.25.0

1 file

3.24.3

1 file

3.24.2

1 file

3.24.1

1 file

3.24.0

1 file

3.23.1

1 file

3.23.0

1 file

3.22.2

1 file

3.22.1

1 file

3.22.0

1 file

3.21.4

1 file

3.21.3

1 file

3.21.2

1 file

3.21.1

1 file

3.21.0

1 file

3.20.5

1 file

3.20.4

1 file

3.20.3

1 file

3.20.2

1 file

3.20.1

1 file

3.20.0

1 file

3.19.4

1 file

3.19.3

1 file

3.19.2

1 file

3.19.1

1 file

3.19.0

1 file

3.18.3

1 file

3.18.2

1 file

3.18.1

1 file

3.18.0

1 file

3.17.0

1 file

3.16.0

1 file

3.15.2

1 file

3.15.1

1 file

3.15.0

1 file

3.14.1

1 file

3.14.0

1 file

3.13.0

1 file

3.12.2

1 file

3.12.1

1 file

3.12.0

1 file

3.11.0

1 file

3.10.1

1 file

3.10.0

1 file

3.9.0

1 file

3.8.3

1 file

3.8.2

1 file

3.8.1

1 file

3.8.0

1 file

3.7.3

1 file

3.7.2

1 file

3.7.1

1 file

3.7.0

1 file

3.6.3

1 file

3.6.2

1 file

3.6.1

1 file

3.6.0

1 file

3.5.1

1 file

3.5.0

1 file

3.4.1

1 file

3.4.0

1 file

3.3.1

1 file

3.3.0

1 file

3.2.0

1 file

3.1.2

1 file

3.1.1

1 file

3.1.0

1 file

3.0.0

1 file

2.9.1

1 file

2.9.0

1 file

2.8.4

1 file

2.8.3

1 file

2.8.2

1 file

2.8.1

1 file

2.8.0

1 file

2.7.8

1 file

2.7.7

1 file

2.7.6

1 file

2.7.5

1 file

2.7.4

1 file

2.7.3

1 file

2.7.2

1 file

2.7.1

1 file

2.7.0

1 file

2.6.3

1 file

2.6.2

1 file

2.6.1

1 file

2.6.0

1 file

2.5.1

1 file

2.5.0

1 file

2.4.3

1 file

2.4.2

1 file

2.4.1

1 file

2.4.0

1 file

2.3.1

1 file

2.3.0

1 file

2.2.2

1 file

2.2.0

1 file

2.1.1

1 file

2.1.0

1 file

2.0.0

1 file

1.6.0

1 file

1.5.8

1 file

1.5.7

1 file

1.5.6

1 file

1.5.5

1 file

1.5.4

1 file

1.5.3

1 file

1.5.2

1 file

1.5.1

1 file

1.5.0

1 file

1.4.5

1 file

1.4.4

1 file

1.4.3

1 file

1.4.2

1 file

1.4.1

1 file

1.4.0

1 file

1.3.4

1 file

1.3.3

1 file

1.3.2

1 file

1.3.1

1 file

1.3.0

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.0

1 file

1.0.1

1 file

1.0.0

1 file

0.25.6

1 file

0.25.5

1 file

0.25.4

1 file

0.25.3

1 file

0.25.2

1 file

0.25.1

1 file

0.25.0

1 file

0.24.0

1 file

0.23.1

1 file

0.23.0

1 file

0.22.2

1 file

0.22.1

1 file

0.22.0

1 file

0.21.1

1 file

0.21.0

1 file

0.20.4

1 file

0.20.3

1 file

0.20.2

1 file

0.20.1

1 file

0.20.0

1 file

0.19.0

1 file

0.18.0

1 file

0.0.1

2 files

0.0.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page