1. Answers
  2. Deploy a Kubernetes argoproj.io Application

How do I deploy a Kubernetes argoproj.io application?

In this guide, we will deploy a Kubernetes application using argoproj.io’s ArgoCD with Pulumi. ArgoCD is a declarative, GitOps continuous delivery tool for Kubernetes. We will create a Kubernetes namespace, deploy ArgoCD, and then use it to manage a sample application.

Key Points

  • We will create a Kubernetes namespace for ArgoCD.
  • We will deploy ArgoCD using a Helm chart.
  • We will configure ArgoCD to manage a sample application.
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";

// Create a Kubernetes namespace for ArgoCD
const argocdNamespace = new k8s.core.v1.Namespace("argocd-namespace", {
    metadata: { name: "argocd" },
});

// Deploy ArgoCD using Helm chart
const argoCdChart = new k8s.helm.v3.Chart("argo-cd", {
    chart: "argo-cd",
    version: "3.23.0",
    fetchOpts: { repo: "https://argoproj.github.io/argo-helm" },
    namespace: argocdNamespace.metadata.name,
    values: {
        server: {
            service: {
                type: "LoadBalancer",
            },
        },
    },
});

// Create a Kubernetes namespace for the sample application
const appNamespace = new k8s.core.v1.Namespace("app-namespace", {
    metadata: { name: "sample-app" },
});

// Define the ArgoCD Application to manage the sample application
const app = new k8s.apiextensions.CustomResource("sample-app", {
    apiVersion: "argoproj.io/v1alpha1",
    kind: "Application",
    metadata: {
        namespace: argocdNamespace.metadata.name,
        name: "sample-app",
    },
    spec: {
        project: "default",
        source: {
            repoURL: "https://github.com/argoproj/argocd-example-apps",
            targetRevision: "HEAD",
            path: "guestbook",
        },
        destination: {
            server: "https://kubernetes.default.svc",
            namespace: appNamespace.metadata.name,
        },
        syncPolicy: {
            automated: {
                prune: true,
                selfHeal: true,
            },
        },
    },
});

export const argoCdUrl = argoCdChart.getResource("v1/Service", "argocd/argocd-server").status.loadBalancer.ingress[0].hostname;

Summary

In this guide, we deployed a Kubernetes application using ArgoCD with Pulumi. We created namespaces for ArgoCD and the sample application, deployed ArgoCD using a Helm chart, and configured ArgoCD to manage the sample application. This setup allows you to leverage GitOps practices for continuous delivery in your Kubernetes cluster.

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