1. Deploy the plex-rclone-wireguard helm chart on Rancher

    TypeScript

    To deploy a Helm chart on a Rancher-managed Kubernetes cluster, you will need to have a Rancher cluster setup and configured with Pulumi. The Pulumi Rancher 2 provider allows you to interact with and manage your Rancher resources.

    In this guide, you will write a Pulumi program in TypeScript to deploy the plex-rclone-wireguard Helm chart to a Kubernetes cluster managed by Rancher. Note that the exact Helm chart might not be directly available in public Helm repositories, so we will assume you have the chart available in a custom Helm repository or locally.

    Here's what the Pulumi program will do:

    1. Create a Namespace: This will create a new namespace in Kubernetes where your Helm chart will be deployed.
    2. Install the Helm Chart: Using the pulumi-kubernetes package, we'll install the Helm chart for Plex with Rclone and WireGuard within the created namespace.

    Prerequisites

    Before you begin, ensure you have:

    • A Rancher-managed Kubernetes cluster.
    • Kubeconfig file downloaded for your cluster to interact with it.
    • Pulumi CLI installed and set up with your cloud provider.
    • Access to a Helm chart repository that contains the plex-rclone-wireguard chart, or have the chart available locally.

    Pulumi Program Example

    Below is a TypeScript program that demonstrates how to deploy a Helm chart in a Rancher-managed cluster. This program assumes you are using a Helm repository that contains the chart.

    import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; import * as rancher2 from '@pulumi/rancher2'; const config = new pulumi.Config(); // Fetch the kubeconfig from Rancher cluster. const kubeConfig = config.requireSecret('kubeConfig'); // Create a Pulumi Kubernetes provider that uses the kubeconfig. const k8sProvider = new k8s.Provider('k8s', { kubeconfig: kubeConfig, }); // Create a Kubernetes namespace for the deployment const namespace = new k8s.core.v1.Namespace('plex-namespace', { metadata: { // The name of the namespace name: 'plex', }, }, { provider: k8sProvider }); // Deploy the plex-rclone-wireguard Helm chart const plexHelmChart = new k8s.helm.v3.Chart('plex-rclone-wireguard', { chart: 'plex-rclone-wireguard', version: '1.0.0', // Replace with the correct chart version fetchOpts: { repo: 'http://my-custom-helm-repo/', // Replace with your Helm repository }, namespace: namespace.metadata.name, // Values to pass to your Helm chart values: { service: { type: 'ClusterIP', // Change this as needed }, wireguard: { // Wireguard specific configuration }, rclone: { // Rclone specific configuration } // ... other configuration values }, }, { provider: k8sProvider, dependsOn: [namespace] }); // Export the namespace and Helm release name export const plexNamespace = namespace.metadata.name; export const plexHelmReleaseName = plexHelmChart.releaseName;

    Usage

    With this Pulumi program:

    • A Kubernetes namespace called plex is created.
    • The plex-rclone-wireguard Helm chart is deployed to the plex namespace on the Kubernetes cluster.

    Before running the program, you need to replace:

    • The placeholder for kubeConfig with the actual kubeconfig content from your Rancher cluster.
    • The repo field under fetchOpts with the correct URL of your custom Helm repository.
    • The version with the specific version of the chart you want to deploy.

    You should also provide the appropriate values for the plex-rclone-wireguard chart under the values field, changing it to match your desired configuration for Plex, Rclone, and WireGuard.

    Once you've set up the program, you can run it using the following Pulumi CLI commands:

    pulumi stack init # Initializes a new stack for your project pulumi up # Review and execute the deployment

    After successfully running the command, you'll see the outputs printed to your console, indicating the namespace and Helm release name used for the deployment.