Skip to content

szaffarano/argocd-sandbox

Repository files navigation

Build status Docker Image Version (latest semver) Docker Image Size (tag)

ArgoCD POC

CI/CD pipeline POC using

Environment setup

  1. Install minikube and create a testing environment with nginx ingress support
minikube start
minikube addons enable ingress
  1. Install ArgoCD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  1. Patch the ingress by adding --enable-ssl-passthrough to the container args:
kubectl edit deployments.apps -n ingress-nginx ingress-nginx-controller

For instance:

      containers:
      - args:
        - /nginx-ingress-controller
        - --election-id=ingress-nginx-leader
        - --controller-class=k8s.io/ingress-nginx
        - --watch-ingress-without-class=true
        - --configmap=$(POD_NAMESPACE)/ingress-nginx-controller
        - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
        - --udp-services-configmap=$(POD_NAMESPACE)/udp-services
        - --validating-webhook=:8443
        - --validating-webhook-certificate=/usr/local/certificates/cert
        - --validating-webhook-key=/usr/local/certificates/key
        - --enable-ssl-passthrough
  1. Create argocd Ingress
kubectl apply -f infra/argocd/ingress.yaml -n argocd

In order to access the argocd web app or use the CLI, as well as for the examples to work, you have to include argocd.local in your /etc/hosts (also production.local and staging.local are needed to test the environments managed by CI/CD)

cat /etc/hosts
...
192.168.49.2 argocd.local staging.local production.local

Check the IP address running

kubectl get ingress -n argocd

(Do the same once the staging/production ingress are created by ArgoCD or manually)

  1. Login and change the password
argocd admin initial-password -n argocd
argocd login argocd.local
argocd account update-password
  1. Install image updater
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj-labs/argocd-image-updater/stable/manifests/install.yaml
  1. Create staging and production namespaces
k create namespace production
k create namespace staging
  1. Create the argocd apps
k apply -f infra/argocd/apps/staging.yaml
k apply -f infra/argocd/apps/production.yaml

After a while both staging and production namespaces should have been deployed. You can test them using curl

curl staging.local/version
{"Version":"dev-59e8506","Commit":"59e8506"}

curl production.local/version
{"Version":"v0.1.7","Commit":"9292973"}