Deploy the ms-hello-python helm chart on AWS EKS
TypeScriptTo deploy the
ms-hello-python
Helm chart on an AWS Elastic Kubernetes Service (EKS) cluster using Pulumi, you'll take the following steps:- Create an EKS Cluster: You'll use the Pulumi EKS package to create a managed Kubernetes cluster on AWS.
- Deploy a Helm Chart: With the Kubernetes cluster up and running, you'll use the Pulumi Kubernetes provider to deploy the
ms-hello-python
Helm chart onto your EKS cluster.
Below is a Pulumi program in TypeScript that demonstrates these steps:
First, ensure you have Pulumi installed and set up with your AWS credentials. If not, follow the Pulumi Getting Started guide and the AWS Setup guide. Also, ensure you have kubectl,
helm
, the AWS CLI, andeksctl
installed for working with AWS EKS clusters.import * as pulumi from '@pulumi/pulumi'; import * as eks from '@pulumi/eks'; import * as k8s from '@pulumi/kubernetes'; // Step 1: Create an EKS Cluster // This will provision a new EKS cluster with the default settings. For production use, you may need // to customize the cluster configuration. const cluster = new eks.Cluster('my-cluster', { desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", deployDashboard: false }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the ms-hello-python Helm chart // Ensure to replace `<YOUR-CHART-REPO>` with the actual chart repo URL or name if it's from a known repository // such as stable or incubator which does not need a full URL. const helloPythonChart = new k8s.helm.v3.Chart('ms-hello-python', { chart: "ms-hello-python", version: "1.0.0", // Replace with the desired chart version fetchOpts: { repo: "<YOUR-CHART-REPO>", }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig }) }); // After running `pulumi up`, your EKS cluster will be up and running, and the ms-hello-python // application will be deployed to it via Helm chart.
Before running this code:
- Replace
<YOUR-CHART-REPO>
with the actual repository where thems-hello-python
Helm chart is hosted. - Adjust the
desiredCapacity
,minSize
, andmaxSize
according to your needs. This configuration specifies the number of worker nodes for the EKS cluster. - The
storageClasses
parameter is set to usegp2
volumes, which are General Purpose SSD volumes in AWS. Update this if you require a different storage class. - The
deployDashboard
is set tofalse
as the Kubernetes Dashboard is now considered a security risk and it's recommended to manage clusters usingkubectl
, the AWS Management Console, or other tools. - The Helm chart version
1.0.0
is specified as an example. Please replace it with the actual version you intend to deploy.
To run the Pulumi program, save the above code in a
index.ts
file, and then execute:pulumi up
This will prompt Pulumi to provision the AWS EKS cluster and deploy the specified Helm chart to it. If everything is successful, you'll have the
ms-hello-python
application running on an EKS cluster.