Deploy the saleor helm chart on AWS EKS
TypeScriptDeploying a Helm chart onto an Amazon Elastic Kubernetes Service (EKS) cluster involves several steps. We'll first create the Kubernetes cluster using Amazon EKS. Then, we deploy the chart using the Pulumi Kubernetes provider.
Here's an outline of what we'll do:
- Set up an EKS cluster.
- Deploy a Helm chart to that EKS cluster.
We'll be using Pulumi's
eks
package to create the cluster, since it provides a high-level abstraction for managing EKS clusters, and Pulumi'skubernetes
package to deploy the Helm chart.Step 1: Set up an EKS Cluster
The first step is to create an EKS cluster where our Helm chart will be deployed. This includes defining an instance type for the worker nodes, the desired number of nodes, and the machine image to use. We will use the
eks.Cluster
resource, which simplifies creating an EKS cluster.Step 2: Deploy the Helm Chart
Once the EKS cluster is set up, we'll deploy the Saleor Helm chart to it. We'll use a
helm.v3.Chart
resource for this. This higher-level component manages a Helm chart's release via Pulumi, by deploying it into the target Kubernetes cluster. It assumes that Helm is properly configured on your path.Here's a Pulumi program in TypeScript that accomplishes the above tasks:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Create an EKS cluster const cluster = new eks.Cluster("saleor-cluster", { instanceType: "t3.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the Saleor Helm chart to the EKS cluster // We create a k8s provider that uses the kubeconfig from the newly created EKS cluster const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig, }); // Define the Saleor Helm chart. Make sure to replace `chartRepoUrl` and `chartVersion` // with appropriate values for the Saleor chart you wish to deploy. const saleorChart = new k8s.helm.v3.Chart("saleor-chart", { repo: "chartRepoUrl", // Replace with the actual Helm repository URL chart: "saleor", version: "chartVersion", // Replace with the chart version you want to deploy // Define values for the chart as needed. values: { // Add necessary values here }, }, { provider: k8sProvider }); // Exporting the public service endpoint export const saleorEndpoint = saleorChart.getResourceProperty("v1/Service", "saleor", "status").apply(status => status.loadBalancer.ingress[0].hostname);
Explanation and Process
- We first pull in the required Pulumi packages:
@pulumi/eks
,@pulumi/kubernetes
, and@pulumi/pulumi
. - We create an EKS cluster with the desired node size and count specified by
instanceType
,desiredCapacity
,minSize
, andmaxSize
. - After the EKS cluster is created, we export
kubeconfig
. This is the configuration needed by kubectl and the Kubernetes Pulumi provider to communicate with the Kubernetes cluster. - A Kubernetes Pulumi provider is instantiated using the
kubeconfig
from the EKS cluster creation. This tells Pulumi how to communicate with the EKS cluster to deploy Kubernetes resources. - Finally, we use the Kubernetes Pulumi provider to deploy the Saleor Helm chart. Replace
chartRepoUrl
andchartVersion
with the actual Helm chart repository URL and the version of the Saleor chart you want to use.
To launch this stack, you would typically use Pulumi's CLI tools. Save the code in a file called
index.ts
, runpulumi up
, and Pulumi will execute the code to create your cluster and deploy the Saleor application.For more information on: