Skip to main content

A Pulumi package for managing Kubernetes proxies during provisioning.

Project description

Kubernetes Proxy Pulumi Provider

A [Pulumi] provider that proxies a port on the host to a port on a pod in the cluster during provisioning.

Warning: The way this fits into the Pulumi model is sketchy. It might break in future Pulumi releases. Use at your own risk!

This can be useful to use Pulumi to provision services that run within the cluster that are not publicly accessible, like a database.

Usage example

To provision a PostgreSQL database running in Kubernetes:

import pulumi_kubernetes_proxy as k8s_proxy

# Hardcode a port that is likely to be free. This needs to be stable (i.e., we
# can't just let the kernel allocate a free port) so that Pulumi doesn't
# perpetually show a diff in the PostgreSQL provider.
PORT = 32123

eks_cluster = eks.Cluster(...)

k8s_proxy.Provider(
    "postgresql-proxy",
    kubeconfig=eks_cluster.kubeconfig,
    host_port=PORT,
    remote_port=5432,   # Target the PostgreSQL port.
    namespace="default",
    pod_selector="workload=postgresql",
)

provider = postgresql.Provider(
    base_name,
    host="localhost",
    port=PORT,
    connect_timeout=10,
    database="db",
    username="user",
    password="pass",
    opts=pulumi.ResourceOptions(depends_on=[rds_proxy_provider]),
)

Project details


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_proxy-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file pulumi_kubernetes_proxy-0.1.0.tar.gz.

File metadata

  • Download URL: pulumi_kubernetes_proxy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for pulumi_kubernetes_proxy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15cbf665cbfe65c37f811db5661b889dfde0a90accbb521e2471f2744975b320
MD5 54ee15db746cee979f2b8a03ce814705
BLAKE2b-256 69891a4e85fc4f5f479bff8d1d4504cb5927d331576a6c61729c2552c8b45729

See more details on using hashes here.

Supported by

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