1. Deploy the quickstart-python helm chart on AWS EKS


    To deploy a Helm chart to AWS Elastic Kubernetes Service (EKS), you'll need to perform several steps. First, you must create an EKS cluster and configure your local environment to manage the Kubernetes cluster using kubectl. After the cluster is set up, you can deploy the Helm chart, which is a pre-packaged set of Kubernetes resources.

    Here's a Pulumi program that walks through these steps:

    1. Create an EKS cluster. You'll need to define an EKS cluster resource in your Pulumi program. For this purpose, we can use the eks.Cluster resource from the eks package. This resource can create an EKS cluster with specified node sizes, counts, and other configurations.

    2. Install the Helm chart. Once your EKS cluster is ready, you can use the helm.v3.Chart resource from the kubernetes package to install the Helm chart. Pulumi can install a chart from any Helm chart repository or from a local path.

    Here's a Pulumi TypeScript program that accomplishes the above:

    import * as eks from '@pulumi/eks'; import * as kubernetes from '@pulumi/kubernetes'; // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster('my-cluster'); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our EKS cluster's kubeconfig. const provider = new kubernetes.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the quickstart-python Helm chart to the EKS cluster. const quickstartPythonChart = new kubernetes.helm.v3.Chart('quickstart-python', { chart: 'quickstart-python', fetchOpts: { repo: 'https://charts.example.com/', // Replace with the Helm chart repository URL }, }, { provider }); // Export the endpoint of the Kubernetes services deployed via the Helm chart, if any. export const serviceEndpoint = quickstartPythonChart.getResourceProperty('v1/Service', 'quickstart-python', 'status');

    Important points to understand in this program:

    • eks.Cluster: This resource is used to provision an EKS cluster. You can customize the cluster by specifying properties such as node instance type, min and max size of node groups, whether to enable Fargate, etc. (EKS Cluster Documentation)

    • kubernetes.Provider: This resource sets up a Kubernetes provider instance to interact with our new EKS cluster. It uses the cluster's kubeconfig, which contains all the necessary configuration to connect to our cluster. (Kubernetes Provider Documentation)

    • kubernetes.helm.v3.Chart: This is used for deploying Helm charts in a Kubernetes cluster. In this case, it installs the quickstart-python chart into the EKS cluster. You need to specify the chart name and the repository where the chart can be found. Make sure to replace 'https://charts.example.com/' with the actual repository URL where the quickstart-python chart is located. (Helm Chart Documentation)

    • kubeconfig and serviceEndpoint are exported values. The kubeconfig gives you access to interact with your EKS cluster using tools like kubectl. The serviceEndpoint may provide the address to access the deployed application if it exposes a service—though this will depend on the specifics of the Helm chart.

    To use this Pulumi program, you'd save it in a file (e.g., index.ts), and then you can run pulumi up to provision the resources. Make sure you have the Pulumi CLI installed and configured with AWS credentials before running the command.

    Remember that Helm charts can define various Kubernetes resources, including deployments, services, and ingress rules. The quickstart-python chart mentioned here is hypothetical and used as an example. You'll need to use the actual chart name you wish to deploy and might need to provide additional configuration parameters specific to the chart through the values property of the helm.v3.Chart resource.