Deploy the cloudflare-tunnel-ingress-controller helm chart on AWS EKS
TypeScriptTo deploy the Cloudflare Tunnel Ingress Controller Helm chart on AWS EKS, we will go through the following steps:
- Setup an EKS Cluster: We will create a new Amazon EKS cluster which is required to manage our Kubernetes containers.
- Deploy the Helm Chart: Once the cluster is up and running, we will use Pulumi's
kubernetes
provider to deploy the Cloudflare Tunnel Ingress Controller Helm chart.
Here's a program that accomplishes the deployment on AWS EKS:
import * as eks from '@pulumi/eks'; import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster. 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; // Create a Kubernetes provider instance that uses our EKS cluster from above. const provider = new k8s.Provider('provider', { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the Cloudflare Tunnel Ingress Controller Helm chart. const cloudflareTunnel = new k8s.helm.v3.Chart('cloudflare-tunnel', { chart: 'cloudflare-tunnel-ingress-controller', version: '0.1.0', // Replace with actual chart version fetchOpts: { repo: 'https://helm.cloudflare.com/', // Replace with actual Helm chart repository }, // You may need to specify additional chart values here, depending on the chart requirements }, { provider }); // Export any of the useful outputs. export const cloudflareTunnelStatus = cloudflareTunnel.status;
Explanation:
-
EKS Cluster: We use the
eks.Cluster
class from the@pulumi/eks
package to create a new EKS cluster. ThedesiredCapacity
,minSize
, andmaxSize
determine the number of worker nodes in your cluster. -
Kubeconfig: The
kubeconfig
output is the configuration needed to connect to your cluster withkubectl
and other Kubernetes tools. -
Kubernetes Provider: The
k8s.Provider
class from the@pulumi/kubernetes
package is utilized to create a Kubernetes provider that is configured to connect to the newly created EKS cluster. -
Helm Chart: Finally, the
k8s.helm.v3.Chart
class is used to deploy the helm chart. You need to specify the chart name, version, and the repository. If the Helm chart requires additional values, they can be specified in thevalues
argument.
Please note that you need to replace
'0.1.0'
with the actual chart version and'https://helm.cloudflare.com/'
with the actual Helm chart repository URL for the Cloudflare Tunnel Ingress Controller, which were placeholders in this code.After deploying this program with Pulumi, the EKS cluster will be set up, and the Cloudflare Tunnel Ingress Controller will be deployed onto it.
Remember to export other necessary details as stack outputs if you need to access them post-deployment. For instance, any service endpoint URLs, login credentials, or internal resource identifiers might be useful to export.