1. Deploy the laravel-worker helm chart on AWS EKS


    To deploy the laravel-worker Helm chart on AWS Elastic Kubernetes Service (EKS), you need to accomplish several tasks. First, you will create an EKS cluster, set up an ECR repository (if your images are private), and then use the Helm chart to deploy the worker service. Below you'll find a Pulumi program written in TypeScript that guides you through these steps.

    We assume you have the necessary AWS and Kubernetes configurations in place, such as AWS credentials and kubeconfig.

    Step 1: Set up the EKS Cluster

    Create an EKS cluster using high-level components provided by Pulumi. We will define a cluster with default settings appropriate for development purposes.

    import * as eks from "@pulumi/eks"; import * as awsx from "@pulumi/awsx"; // Create a VPC for our cluster const vpc = new awsx.ec2.Vpc("my-vpc", { numberOfAvailabilityZones: 2 }); // Create an EKS cluster with the default configuration const cluster = new eks.Cluster("my-cluster", { vpcId: vpc.id, subnetIds: vpc.privateSubnetIds, instanceType: "t2.medium", // Suitable for dev, choose a bigger instance if needed desiredCapacity: 2, // Number of worker nodes minSize: 1, maxSize: 3, storageClasses: "gp2", // Default storage class deployDashboard: false, // Kubernetes dashboard not required for this setup }); // Export the cluster's kubeconfig export const kubeconfig = cluster.kubeconfig;

    This code sets up a new VPC for your cluster and provisions the EKS cluster with two worker nodes of type t2.medium. Adjust the instance type and the number of nodes as needed.

    Step 2: Deploy the Helm Chart

    Deploy the laravel-worker Helm chart on the cluster. The laravel-worker chart should be publicly available in a Helm chart repository; replace REPO_URL with the actual repository URL and CHART_VERSION with the desired chart version.

    import * as k8s from "@pulumi/kubernetes"; // Initialize a Kubernetes provider instance with the kubeconfig from the EKS cluster we created const provider = new k8s.Provider("provider", { kubeconfig: cluster.kubeconfig }); // Deploy the laravel-worker Helm chart const laravelWorkerChart = new k8s.helm.v3.Chart("laravel-worker", { chart: "laravel-worker", version: "CHART_VERSION", // Use the version of the chart you prefer fetchOpts: { repo: "REPO_URL", // The URL where your Helm chart is hosted }, }, { provider: provider }); // Alternatively, if the chart is packaged and available on your filesystem, you can deploy using the local path: // const laravelWorkerChart = new k8s.helm.v3.Chart("laravel-worker", { // path: "./path-to-your-chart/laravel-worker", // }, { provider: provider });

    Using the @pulumi/kubernetes package, the program initializes a Kubernetes provider to interact with the EKS cluster. The laravel-worker chart is then deployed using the Kubernetes provider. You can specify the version of the chart and the Helm repository URL where the chart is hosted.

    Make sure to replace REPO_URL with the URL of the repository containing the laravel-worker Helm chart, and CHART_VERSION with the appropriate version number you wish to deploy. If the Helm chart is already present on your local filesystem, you can alternatively provide the path to the chart.

    Running this program with Pulumi will set up the entire infrastructure, including the EKS cluster and the laravel-worker on that cluster. To execute the program, save it as index.ts, run pulumi up, and confirm the deployment.

    Keep in mind that deploying to AWS will incur costs, and managing Kubernetes via Pulumi will also require understanding AWS and Kubernetes concepts.

    For more information about EKS in Pulumi:

    For more information on deploying Helm charts with Pulumi: