1. Answers
  2. How To Set Up ArgoCD On EKS Fargate Nodes?

How to Set Up ArgoCD on EKS Fargate Nodes?

Introduction

In this guide, we will set up ArgoCD on Amazon EKS Fargate nodes using Pulumi in TypeScript. ArgoCD is a declarative, GitOps continuous delivery tool for Kubernetes. Amazon EKS (Elastic Kubernetes Service) is a managed Kubernetes service that makes it easy to run Kubernetes on AWS without needing to install and operate your own Kubernetes control plane or nodes. Fargate is a serverless compute engine for containers that works with EKS, allowing you to run containers without having to manage the underlying infrastructure.

Step-by-Step Explanation

Step 1: Set up Pulumi and AWS

  1. Install Pulumi CLI and configure it with your cloud provider credentials.
  2. Set up an AWS account and configure the AWS CLI with your credentials.
  3. Create a new Pulumi project in TypeScript.

Step 2: Create an EKS Cluster

  1. Define the VPC and subnets for the EKS cluster.
  2. Create the EKS cluster with Fargate profile.
  3. Configure the Fargate profile to use the specified subnets and namespaces.

Step 3: Deploy ArgoCD

  1. Install the ArgoCD Helm chart in the EKS cluster.
  2. Configure the ArgoCD settings, such as the namespace and service type.
  3. Apply the ArgoCD manifests to the cluster.

Key Points

  • Pulumi allows you to define and manage your cloud infrastructure using code.
  • Amazon EKS provides a managed Kubernetes service, simplifying the deployment and management of Kubernetes clusters.
  • Fargate enables serverless compute for containers, eliminating the need to manage underlying infrastructure.
  • ArgoCD is a powerful GitOps tool for continuous delivery in Kubernetes environments.

Conclusion

By following this guide, you have successfully set up ArgoCD on Amazon EKS Fargate nodes using Pulumi in TypeScript. This setup leverages the power of Pulumi for infrastructure as code, Amazon EKS for managed Kubernetes, and Fargate for serverless compute, providing a robust and scalable solution for continuous delivery in Kubernetes.

Full Code Example

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 a VPC
const vpc = new aws.ec2.Vpc("eks-vpc", {
    cidrBlock: "10.0.0.0/16",
    enableDnsHostnames: true,
    enableDnsSupport: true,
    tags: { Name: "eks-vpc" },
});

// Create subnets
const subnet1 = new aws.ec2.Subnet("subnet1", {
    vpcId: vpc.id,
    cidrBlock: "10.0.1.0/24",
    availabilityZone: "us-west-2a",
    tags: { Name: "subnet1" },
});

const subnet2 = new aws.ec2.Subnet("subnet2", {
    vpcId: vpc.id,
    cidrBlock: "10.0.2.0/24",
    availabilityZone: "us-west-2b",
    tags: { Name: "subnet2" },
});

// Create an EKS cluster
const cluster = new eks.Cluster("eks-cluster", {
    vpcId: vpc.id,
    subnetIds: [subnet1.id, subnet2.id],
    instanceType: "t3.medium",
    desiredCapacity: 2,
    minSize: 1,
    maxSize: 3,
    enabledClusterLogTypes: ["api", "audit", "authenticator"],
    tags: { Name: "eks-cluster" },
});

// Create a Fargate profile
const fargateProfile = new aws.eks.FargateProfile("fargate-profile", {
    clusterName: cluster.eksCluster.name,
    podExecutionRoleArn: cluster.instanceRoles.apply(roles => roles[0].arn),
    subnetIds: [subnet1.id, subnet2.id],
    selectors: [{ namespace: "default" }],
});

// Deploy ArgoCD using Helm
const argoCd = new k8s.helm.v3.Chart("argo-cd", {
    chart: "argo-cd",
    version: "3.21.0",
    fetchOpts: { repo: "https://argoproj.github.io/argo-helm" },
    values: {
        server: {
            service: {
                type: "LoadBalancer",
            },
        },
    },
    namespace: "argocd",
}, { provider: cluster.provider });

export const vpcId = vpc.id;
export const subnetIds = [subnet1.id, subnet2.id];
export const eksClusterName = cluster.eksCluster.name;
export const argoCdUrl = argoCd.getResource("v1/Service", "argocd/argo-cd-server").status.loadBalancer.ingress[0].hostname;

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up