Deploy the seldon-abtest helm chart on Kubernetes
TypeScriptIn order to deploy the
seldon-abtest
Helm chart on a Kubernetes cluster using Pulumi, we need to use thekubernetes.helm.v3.Chart
resource. This resource allows you to declare a Helm chart as part of your Pulumi application.Before you proceed, make sure you have the following prerequisites met:
- Helm: Ensure that you have Helm installed, as you will need it to deploy a Helm chart.
- Kubernetes Cluster: You should have access to a Kubernetes cluster and the
kubeconfig
for the cluster should be configured correctly on the machine where you're running Pulumi. - Pulumi: You must have Pulumi installed and setup on your machine.
Here's a simple Pulumi program in TypeScript which deploys the
seldon-abtest
Helm chart to a Kubernetes cluster:import * as k8s from '@pulumi/kubernetes'; // This example deploys the "seldon-abtest" Helm chart to your Kubernetes cluster. // The `kubernetes.helm.v3.Chart` resource from the Pulumi Kubernetes provider is utilized here. // Create a Helm chart resource. const seldonAbTestChart = new k8s.helm.v3.Chart("seldon-abtest", { // Specify the chart repository. This is a placeholder and should be replaced with the actual repo URL or name. repo: "seldon-helm-repo", // Specify the name of the chart. Use "seldon-abtest" or the applicable chart name if different. chart: "seldon-abtest", // Specify the chart version. version: "1.0.0", // Specify the namespace where the chart will be installed. namespace: "seldon-system", // Specify any values you want to override in the chart. // The following is an example that should be changed based on your specific requirements. values: { // Replace this with actual values for the seldon-abtest chart. replicaCount: 1, }, // Optionally, if there are additional fetch options you need, configure them here. fetchOpts: { // Here you can specify options such as a specific `version` or `untar` options if needed. }, }, { provider: k8sProvider }); // Ensure to pass the provider if you're using a custom Kubernetes provider // Export the Chart's status. export const seldonAbTestChartStatus = seldonAbTestChart.status;
Explanation of the code:
- We import the
@pulumi/kubernetes
package which contains the necessary classes to interact with Kubernetes. - Within the
k8s.helm.v3.Chart
resource, we need to provide specific properties:repo
: The repository where the Helm chart is located. Make sure to replace"seldon-helm-repo"
with the actual repository name or URL you will be using.chart
: The name of the Helm chart we want to deploy, which in this case is"seldon-abtest"
.version
: The version of the Helm chart that you want to install. It should match a version that is available in the Helm repository.namespace
: The Kubernetes namespace where you want to install this Helm chart. Make sure to replace"seldon-system"
with the namespace you want to use.values
: This is a key-value map where you can provide values to override defaults in the Helm chart. Replace the example values with those relevant to theseldon-abtest
chart.fetchOpts
: This is an optional property to specify additional options related to fetching the Helm chart, such as a certain chart version or untar options.
- Replace the placeholder for the
provider
with an actual instance ofk8s.Provider
if you're managing multiple Kubernetes clusters with Pulumi and need to specify which cluster to deploy to. - We export the status of the Helm Chart deployment so you can easily access and observe its status when the Pulumi program is running.
Make sure to update the placeholders with the actual values that are appropriate for your scenario. In a real-world scenario, you might have to look up the Helm chart repository that hosts the
seldon-abtest
chart and use the correct versions and namespace for your deployment.Run the Pulumi program with the following commands:
pulumi up
This will preview and deploy the Helm chart to your Kubernetes cluster. You can confirm the deployment with
kubectl
or by checking the Pulumi service's output.