Deploy the ansible-automation-platform helm chart on AWS EKS
TypeScriptTo deploy the Ansible Automation Platform Helm chart on AWS EKS using Pulumi, we need to follow these steps:
- Set up an EKS cluster using the
eks
package, which provides high-level components to work with Amazon EKS. - Deploy the Helm chart to the EKS cluster using the
kubernetes
package.
For this task, we need to use several resources from Pulumi:
-
eks.Cluster
creates and manages an EKS cluster: EKS Cluster documentation -
kubernetes.helm.sh/v3.Chart
is used to deploy a Helm chart on a Kubernetes cluster: Helm Chart documentation
Below is a Pulumi program written in TypeScript that carries out this task:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("ansible-eks-cluster", { // Specify the desired version for the EKS Cluster. version: "1.21", // Other cluster configuration here ... }); // Export the clusters' kubeconfig. export const kubeconfig = cluster.kubeconfig; // Once we have the cluster reference, we can deploy the Ansible Automation Platform Helm chart. // You will need to specify the correct repository and chart name for the Ansible Automation Platform. const ansibleAutomationPlatform = new k8s.helm.v3.Chart("ansible-platform-chart", { chart: "ansible-automation-platform", version: "x.y.z", // specify the chart version you wish to deploy fetchOpts: { repo: "http://helm-repository-url/", // specify the repository URL hosting the chart }, // If there are any specific configuration values you wish to set, you would include them in 'values'. values: { // Custom values for the Helm chart. }, }, { provider: cluster.provider }); // To ensure Helm chart is installed after the EKS cluster is ready, // set a dependency on the cluster's kubeconfig. ansibleAutomationPlatform.dependsOn(cluster.kubeconfig);
In this program:
- We set up the EKS cluster through the
eks.Cluster
class. - We deploy the Ansible Automation Platform using a Helm chart via
k8s.helm.v3.Chart
. - The
kubeconfig
is exported so you can usekubectl
to interact with the cluster from your local machine. - We specify dependencies to ensure that the Helm chart is only deployed after the EKS cluster is ready. This is done by making
ansibleAutomationPlatform
depend oncluster.kubeconfig
. - Please replace
"http://helm-repository-url/"
with the actual repository URL and"ansible-automation-platform"
with the correct Helm chart name and version, as appropriate. These details should be obtainable from the Helm chart repository you are using for the Ansible Automation Platform.
Make sure you have authenticated with AWS and set your desired region before running the Pulumi program. On successful deployment, you will have an EKS cluster with Ansible Automation Platform deployed on it.
- Set up an EKS cluster using the