Deploy the shopware helm chart on Rancher
TypeScriptTo deploy the Shopware Helm chart on a Rancher-managed Kubernetes cluster, you need to have a Rancher cluster running and accessible. Once you have that, you can use Pulumi to install the Shopware Helm chart by creating an instance of the
helm.v3.Chart
class within your cluster.Here's a step-by-step guide to help you accomplish this:
Pulumi Program to Deploy Shopware Helm Chart on Rancher
-
Set Up the Pulumi Project: Ensure that you have already configured Pulumi for TypeScript and logged in to the Rancher cluster where you intend to deploy the Shopware Helm chart.
-
Install Required Packages: Install the Pulumi Rancher2 and Pulumi Kubernetes packages using npm or yarn:
npm install @pulumi/rancher2 @pulumi/kubernetes
or
yarn add @pulumi/rancher2 @pulumi/kubernetes
-
Import Necessary Libraries: In your TypeScript program, you will need to import the Pulumi libraries for Rancher2 and Kubernetes:
import * as rancher2 from "@pulumi/rancher2"; import * as kubernetes from "@pulumi/kubernetes";
-
Create the Helm Chart: Use Pulumi's Kubernetes provider to deploy the Shopware Helm chart into your Rancher cluster. The chart can be sourced from its repository, and you can pass any required values to customize your Shopware deployment.
Here is how you would structure the TypeScript program:
import * as pulumi from "@pulumi/pulumi"; import * as kubernetes from "@pulumi/kubernetes"; // You should first create or configure access to your Rancher-managed Kubernetes cluster. // Create a Kubernetes provider instance that uses the context for the Rancher-managed cluster. const clusterProvider = new kubernetes.Provider("rancher-k8s", { kubeconfig: "<kubeconfig>", // Replace this with your kubeconfig file content }); // Now you define the Shopware Helm chart using the Pulumi Kubernetes provider const shopwareChart = new kubernetes.helm.v3.Chart("shopware-chart", { // Assuming there is a Helm chart for Shopware available, you would specify the repo // where the chart can be found and the corresponding chart name. // Here's an example structure. However, you will need to verify if these values are correct. chart: "shopware", version: "1.0.0", // The version of the chart you want to deploy fetchOpts: { repo: "https://charts.shopware.com/", // The repository URL where the chart is located }, values: { // Here you would put the necessary configuration for the Shopware chart. // This is an example and may not match the actual configuration you need. service: { type: "ClusterIP", }, // ... more configuration ... }, }, { provider: clusterProvider }); // Export the name of the chart as an output export const shopwareChartName = shopwareChart.metadata.apply(m => m.name);
Remember to replace the placeholder
<kubeconfig>
with your actual kubeconfig contents that allow you to connect to your Rancher cluster. It's also important to replace the chart information (chart
,version
,repo
) with the correct details from the official Shopware Helm chart, which may differ from the example placeholders used here.The above program sets up and deploys the Shopware Helm chart to your cluster. Adjust the configuration inside the
values
parameter as needed to match the Shopware chart's configuration options you wish to set during deployment.Next Steps
-
Run Your Pulumi Program: Use the Pulumi CLI to run your program:
pulumi up
-
Access Your Shopware Instance: Once the deployment is successful, you can access your Shopware instance using the Service endpoint provided by Kubernetes.
-
Clean Up: If you ever want to remove the Shopware chart from your cluster, you can run:
pulumi destroy
This Pulumi program has given you an overview of the process of deploying an existing Helm chart (like Shopware which is assumed to be available) on a Kubernetes cluster managed by Rancher. As you explore further into managing your Helm charts with Pulumi, you can build upon this foundation, adding more customization, and utilizing other Pulumi features to manage a more complex infrastructure.
-