ArgoCD Setup on Kubernetes/OpenShift Cluster

Setup ArgoCD on OpenShift Cluster

Follow below steps to setup ArgoCD onto your OpenShift cluster.

Step 1: Create Project namespace

To set up a Argo CD instance, create an argocd instance namespace on OpenShift as its uses dedicated namespaces to run the instance.

--- Create dedicated Namespace---
$ oc create namespace argocd

Step 2: Apply the ArgoCD Manifest on OpenShift

Now we can perform the actual installation of ArgoCD on OpenShift cluster by running the installation manifest.

$mkdir argocd
$cd argocd
$wget https://raw.githubusercontent.com/argoproj/argo-$cd/stable/manifests/install.yaml
$oc apply -n argocd -f ./install.yaml
customresourcedefinition.apiextensions.k8s.io/applications.argoproj.io created
customresourcedefinition.apiextensions.k8s.io/appprojects.argoproj.io created
serviceaccount/argocd-application-controller created
serviceaccount/argocd-dex-server created
serviceaccount/argocd-server created
role.rbac.authorization.k8s.io/argocd-application-controller created
role.rbac.authorization.k8s.io/argocd-dex-server created
role.rbac.authorization.k8s.io/argocd-server created
clusterrole.rbac.authorization.k8s.io/argocd-application-controller created
clusterrole.rbac.authorization.k8s.io/argocd-server created
rolebinding.rbac.authorization.k8s.io/argocd-application-controller created
rolebinding.rbac.authorization.k8s.io/argocd-dex-server created
rolebinding.rbac.authorization.k8s.io/argocd-server created
clusterrolebinding.rbac.authorization.k8s.io/argocd-application-controller created
clusterrolebinding.rbac.authorization.k8s.io/argocd-server created
configmap/argocd-cm created
configmap/argocd-rbac-cm created
configmap/argocd-ssh-known-hosts-cm created
configmap/argocd-tls-certs-cm created
secret/argocd-secret created
service/argocd-dex-server created
service/argocd-metrics created
service/argocd-redis created
service/argocd-repo-server created
service/argocd-server-metrics created
service/argocd-server created
deployment.apps/argocd-application-controller created
deployment.apps/argocd-dex-server created
deployment.apps/argocd-redis created
deployment.apps/argocd-repo-server created
deployment.apps/argocd-server created

Step 3: Get the ArgoCD Server password

Once you confirm all pods are running, get the ArgoCD Server initial pwd which is autogenerated.

$ARGOCD_SERVER_PASSWORD=$(oc -n argocd get pod -l "app.kubernetes.io/name=a

Step 4: Expose ArgoCD Server using OpenShift Route

We need to Patch ArgoCD Server deployment on OpenShift for the service to be exposed through the OpenShift Route:

$oc -n argocd patch deployment argocd-server -p '{"spec":{"template":{"spec":{"$setElementOrder/containers":[{"name":"argocd-server"}],"containers":[{"command":["argocd-server","--insecure","--staticassets","/shared/app"],"name":"argocd-server"}]}}}}'
$deployment.apps/argocd-server patched
$oc -n argocd create route edge argocd-server --service=argocd-server --port=http --insecure-policy=Redirect
$ oc get route -n argocd NAME            HOST/PORT                                         PATH   SERVICES        PORT   TERMINATION     WILDCARD argocd-server   argocd-server-argocd.apps.mycluster.example.com          argocd-server   http   edge/Redirect   None
$echo https://$(oc get routes argocd-server -o=jsonpath='{ .spec.host }')
$ oc edit route -n argocd

Step 5: Download Argo CD CLI

Download the lasted available version of argoCD client from release page

$ VERSION=$(curl --silent "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
$sudo chmod +x /usr/local/bin/argocd
$ argocd version --client
argocd: v1.5.5+0fdef48
BuildDate: 2020-05-16T04:02:57Z
GitCommit: 0fdef4861e12026e133224f7c9413072340e2983
GitTreeState: clean
GoVersion: go1.14.1
Compiler: gc
Platform: linux/amd64
--- Get routes ---
ARGOCD_ROUTE=$(oc -n argocd get route argocd-server -o jsonpath='{.spec.host}')
--- Get Admin password ---
ARGOCD_SERVER_PASSWORD=$(oc -n argocd get pod -l "app.kubernetes.io/name=argocd-server" -o jsonpath='{.items[*].metadata.name}')
--- Login to ArgoCD API ---
argocd --insecure --grpc-web login ${ARGOCD_ROUTE}:443 --username admin --p
argocd --insecure --grpc-web --server ${ARGOCD_ROUTE}:443 account update-pas

Step 6: Access ArgoCD Dashboard

You can then access the ArgoCD console with the route URL.

$kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2

Resetting admin Password

By default the password is set to the name of the server pod.

  • Update the admin.password field with a new bcrypt hash.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kamlesh Prajapati

Kamlesh Prajapati

131 Followers

DevOps Practitioner (CKA certified , RHOCP Certified, Azure Certified on az-104,az-400,az-303.)