1. Deploy the k0s-homelab helm chart on AWS EKS

    TypeScript

    To deploy the k0s-homelab Helm chart on AWS EKS, you'll need to set up several components. These include:

    1. An EKS cluster where your Kubernetes workloads will run.
    2. A Helm chart deployment on the EKS cluster.

    For step 1, you can use the eks Pulumi package, which provides a higher-level abstraction over AWS resources to create and manage an EKS cluster easily.

    For step 2, you'll utilize the kubernetes Pulumi package to deploy Helm charts on a Kubernetes cluster.

    Below is the Pulumi program written in TypeScript that sets up an EKS cluster and deploys the k0s-homelab Helm chart onto it. Before running this program, make sure you have Pulumi CLI installed, configured AWS credentials, and have the necessary permissions to create these resources.

    import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, // Number of worker nodes minSize: 1, maxSize: 3, storageClasses: "gp2", // Default storage class deployDashboard: false, // AWS EKS dashboard is deprecated }); // Create a Kubernetes provider instance using the EKS cluster credentials. const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the k0s-homelab Helm chart on the EKS cluster. const homelabChart = new k8s.helm.v3.Chart("k0s-homelab", { chart: "k0s-homelab", // Specify the Helm repository here if it's not a stable chart // repo: "https://my-helm-repo/repo", version: "1.0.0", // Replace with the desired chart version // Values can be modified to customize the deployment. values: { key: "value", // Replace these with actual values for the homelab chart }, }, { provider: k8sProvider }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig;

    Let's go through the code above:

    • We first create an EKS cluster with a specified number of desired nodes and set the storage class.
    • We then establish a k8s.Provider which is used to interact with the EKS cluster using the cluster's kubeconfig.
    • Following that, we define a Chart resource which represents the k0s-homelab Helm chart. If the Helm chart is not located in a standard repo, you can specify your repository URL using the repo field in the chart definition.
    • Finally, we export the kubeconfig of the EKS cluster. This allows you to interact with your cluster using the kubectl CLI tool.

    Replace "value" in the values field with the actual configuration needed for your k0s-homelab chart. The version field should also be set to the version of the k0s-homelab chart that you wish to deploy.

    To run this program, save it to a file with a .ts extension, and then run pulumi up in your terminal. Pulumi will handle provisioning the AWS EKS cluster along with deploying your Helm chart onto it.

    Keep in mind, setting up AWS EKS can take several minutes. Once the process is completed successfully, you'll have a running EKS cluster with the k0s-homelab Helm chart deployed.