Deploy the ts3-manager helm chart on Rancher
TypeScriptDeploying a Helm chart on Rancher using Pulumi requires several steps. Pulumi interacts with the Rancher platform through the
rancher2
provider, which allows management of Rancher resources such as clusters, workloads, and the Helm chart deployments (via Catalogs and Apps).Here's a high-level overview of the steps required to deploy the ts3-manager Helm chart on Rancher:
- Set up the Rancher2 Provider: We need to instantiate the
rancher2
provider which will allow us to interact with our Rancher instance. - Create or Select a Cluster: If you don't have an existing Rancher Kubernetes cluster, you'll need to create one. If you already have a cluster, you'll need the cluster's ID.
- Add a Helm Chart Repository: We add the repository that contains the ts3-manager Helm chart as a
CatalogV2
resource. - Deploy the Helm Chart: Finally, we deploy the Helm chart to the cluster by creating an
App
resource, which represents a Helm release.
Below is a Pulumi TypeScript program that carries out these steps. In the sample, I assume you've set up your Pulumi program configuration with necessary credentials and that you know the ID of the Rancher cluster where you want to deploy the Helm chart. Please ensure you have the necessary permissions to interact with the cluster.
The program looks something like this:
import * as pulumi from "@pulumi/pulumi"; import * as rancher2 from "@pulumi/rancher2"; // Instantiate the Rancher2 provider const rancher = new rancher2.Provider("my-rancher", { apiURL: "https://<RANCHER_API_ENDPOINT>", accessToken: "<RANCHER_ACCESS_TOKEN>", secretKey: "<RANCHER_SECRET_KEY>", }); // Provide the name of the cluster where you want to deploy the ts3-manager Helm chart const clusterId = "c-xxxxx"; // Add a new Helm chart repository as a CatalogV2 in Rancher const ts3ManagerCatalog = new rancher2.CatalogV2("ts3-manager-catalog", { // Assuming that the repository exists at this URL, replace it with the actual one if needed url: "https://<HELM_CHART_REPOSITORY_URL>", clusterId: clusterId, }, { provider: rancher }); // Deploy the ts3-manager Helm chart const ts3ManagerApp = new rancher2.AppV2("ts3-manager-app", { clusterId: clusterId, // Assuming ts3-manager is the name of the chart within the repository and the // namespace where you want to deploy the chart exists in the cluster namespace: "default", repoName: ts3ManagerCatalog.name, chartName: "ts3-manager", // Replace with a specific chart version if needed chartVersion: "1.0.0", values: ` some-key: some-value another-key: another-value `, }, { provider: rancher }); // Export the Helm chart deployment status export const ts3ManagerAppStatus = ts3ManagerApp.status;
Make sure you fill in the placeholders (like
<RANCHER_API_ENDPOINT>
and<RANCHER_ACCESS_TOKEN>
) with actual values from your Rancher setup.Here's a detailed explanation of key sections in the program:
-
Rancher2 Provider: We set up the provider by specifying the API endpoint of Rancher and credentials (
apiURL
,accessToken
, andsecretKey
). These items authenticate the Pulumi program with your Rancher server. -
Cluster ID: You must specify the ID of the Rancher cluster (
clusterId
) where you want the Helm chart to be deployed. You can retrieve this ID from the Rancher UI or API. -
CatalogV2: Represents a Helm chart repository in Rancher. We create a new CatalogV2 resource with the URL of the Helm chart repository that contains the
ts3-manager
chart. This step is akin to adding a repository withhelm repo add
. -
AppV2: This represents a Helm release. We create a new AppV2 resource to deploy the
ts3-manager
chart from our added repository. We set necessary values like the namespace, repository name, chart name, and version. You may also specify additional values to configure the Helm chart using thevalues
property. -
Export: Finally, we export the status of our Helm chart deployment to view if the chart has been deployed successfully.
To run this Pulumi program, you'll need to have
@pulumi/pulumi
and@pulumi/rancher2
packages installed in your project. If you haven't installed these packages, you can do so by runningnpm install @pulumi/pulumi @pulumi/rancher2
.Make sure the provided
apiURL
,accessToken
,secretKey
, andclusterId
are correct for your Rancher instance and cluster. The URL for the Helm chart repository should also be valid and contain thets3-manager
chart.Once you've set up your Pulumi program with the correct configuration, run
pulumi up
to deploy the Helm chart to your Rancher cluster.If you have any specific configurations or a different namespace where you need to deploy the
ts3-manager
chart, modify the providedvalues
andnamespace
in thets3ManagerApp
resource accordingly.- Set up the Rancher2 Provider: We need to instantiate the