Deploy the flink-kubernetes-operator helm chart on AWS EKS
TypeScriptTo deploy the
flink-kubernetes-operator
Helm chart on AWS EKS, we'll go through the process step by step:-
Create an EKS Cluster: First, we'll set up an Amazon EKS cluster, which will be the Kubernetes cluster where our Helm chart will be deployed. We'll use
aws.eks.Cluster
for this purpose. The EKS cluster provides the necessary Kubernetes infrastructure. -
Install the Helm Chart: Once the EKS cluster is ready, we'll deploy the
flink-kubernetes-operator
Helm chart onto the cluster. Pulumi offers akubernetes.helm.v3.Chart
resource which we'll use to accomplish this. Helm charts are collections of pre-configured Kubernetes resources that can be deployed as one package.
Below is a Pulumi program in TypeScript that outlines these steps. It assumes you have already configured Pulumi to work with your AWS account and you have the necessary AWS credentials set up.
Here is the program:
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('flink-operator-eks', { // Specify additional settings for the EKS cluster as needed. }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider that uses our cluster from above. const k8sProvider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig, }); // Deploy the flink-kubernetes-operator helm chart. const flinkOperatorChart = new k8s.helm.v3.Chart('flink-operator-chart', { chart: 'flink-kubernetes-operator', fetchOpts: { // Specify the repository that hosts the flink-kubernetes-operator chart if it's not in the default Helm repo. repo: 'https://<YOUR_HELM_REPO_URL>', }, // You can override default chart values here, for custom configurations. values: { // Example of a value you might want to override: (Uncomment and replace with actual values) // image: { // repository: 'my-repo/flink', // tag: 'latest', // }, }, }, { provider: k8sProvider }); // Output the status of the deployment. export const flinkOperatorDeploymentName = flinkOperatorChart.getResourceProperty('v1/Deployment', 'flink-operator', 'metadata', 'name');
This program does the following:
- Imports the required Pulumi packages for working with AWS, EKS, and Kubernetes.
- Initializes a new EKS cluster by creating an instance of
eks.Cluster
. You need to fill in additional parameters required to configure your EKS cluster to your specifications, such as node type, size, IAM roles, etc. - Exports the generated kubeconfig which you will need to interact with your Kubernetes cluster.
- Sets up a Pulumi Kubernetes provider configuration using the kubeconfig. This provider is responsible for deploying resources to the EKS cluster.
- Initializes a new Helm chart deployment using
k8s.helm.v3.Chart
and sets the chart name toflink-kubernetes-operator
. Be sure to specify the correct Helm repository where the chart is hosted if it's not part of the default Helm repository. - Optionally overrides the default chart values with custom configuration. As an example, a part that specifies the Docker image to use for the deployment is commented out. You'll need to uncomment and set the appropriate values based on your requirements.
- Finally, the program exports the name of the flink operator deployment from the Helm chart which can be used to verify that the deployment was successful.
This program will create the managed EKS cluster and deploy the
flink-kubernetes-operator
Helm chart onto it. After running this program withpulumi up
, you will have a running EKS cluster with the Flink operator ready to orchestrate Flink jobs.Remember to replace
<YOUR_HELM_REPO_URL>
with the actual URL of the repository that hosts theflink-kubernetes-operator
chart if it is not available in the default Helm chart repository. If the Helm chart is in a public repository, thefetchOpts.repo
attribute can be omitted.To execute this program, save the code to a file with a
.ts
extension, and run it using Pulumi CLI commands likepulumi stack init
,pulumi up
, and so on.-