Deploy the dashkiosk helm chart on AWS EKS
TypeScriptTo deploy the Dashkiosk helm chart on AWS EKS (Elastic Kubernetes Service), we need to perform several steps:
-
Create an EKS Cluster: We'll use
aws.eks.Cluster
to provision a new EKS cluster. The cluster acts as the control plane, managing the Kubernetes environment. -
Define an EKS Node Group: Node groups are sets of worker nodes where our containers (and in this case, the Dashkiosk helm chart) will run. We'll need to define the node group with a certain instance type and desired capacity.
-
Install the Helm Chart: Pulumi allows us to deploy Helm charts on Kubernetes clusters. We'll use a resource called
kubernetes.helm.v3.Chart
to deploy the Dashkiosk application onto our EKS cluster.
For each step, we'll write a TypeScript program using Pulumi. Ensure you have the AWS and Pulumi CLI configured with appropriate credentials before running this program.
Here is the program that accomplishes these tasks:
import * as pulumi from '@pulumi/pulumi'; import * as aws from '@pulumi/aws'; import * as k8s from '@pulumi/kubernetes'; import * as eks from '@pulumi/eks'; // Create an EKS Cluster const cluster = new eks.Cluster('my-cluster', { // Define the desired Kubernetes version and other cluster settings here version: '1.21', // specify your desired Kubernetes version // Other cluster setting (e.g., node types, number of nodes, etc.) }); // Create a Kubernetes Node Group const nodeGroup = cluster.createNodeGroup('my-cluster-ng', { // Choose an instance type, desired capacity, etc. instanceType: 't2.medium', desiredCapacity: 2, // As an example, update the capacity as needed minSize: 1, maxSize: 3, }); // Deploy the Dashkiosk helm chart const dashkioskChart = new k8s.helm.v3.Chart('dashkiosk', { chart: 'dashkiosk', version: 'x.y.z', // specify the chart version you want to deploy fetchOpts: { // If your Helm chart is hosted in a Helm repository, specify the repo's URL here // It is also possible to use a chart that's packaged locally by specifying the `path` repo: '<URL of the Helm chart repository>', }, // Pass any required Helm values here values: { // Custom values for the Dashkiosk Helm chart }, }, {provider: cluster.provider}); // Export the cluster's kubeconfig and NodeGroup details export const kubeConfig = cluster.kubeconfig; export const nodeGroupUrl = nodeGroup.autoScalingGroupName;
This program performs the following actions:
- It defines an EKS cluster using the
eks.Cluster
class. - It creates a node group associated with the cluster that defines the properties of worker nodes such as instance type and scaling settings.
- It deploys the Dashkiosk application using a Helm chart onto the cluster using the
k8s.helm.v3.Chart
resource. You have to specify the chart name, optionally the chart version, and any other custom values you want to provide to the chart.
The
fetchOpts.repo
property should be set to the repository URL where the Dashkiosk Helm chart is hosted. You should replace'<URL of the Helm chart repository>'
with the actual URL.Make sure that you replace
'x.y.z'
with the specific version of the Dashkiosk helm chart you want to use.Notice that the
k8s.helm.v3.Chart
is dependent on the cluster provider. This indicates that the Helm chart should be deployed in the created AWS EKS cluster.Once the program is executed, you can use the exported
kubeConfig
to interact with your Kubernetes cluster usingkubectl
. ThenodeGroupUrl
will give you the AWS Auto Scaling Group name of your node group, which you can use to scale your node group or make other changes in the AWS Management Console.-