How to install ArgoCD on OpenShift cluster

[*]

/ * Custom CSS * /
.tdi_3_2f0.td-a-rec {
Text alignment: centered;
} .tdi_3_2f0 .td-element-style {
z index: -1;
} .tdi_3_2f0.td-a-rec-img {
Text alignment: left;
} .tdi_3_2f0.td-a-rec-img img {
Margin: 0 automatic 0 0;
@Media (maximum width: 767 pixels) {media
.tdi_3_2f0.td-a-rec-img {
Text alignment: centered;
}
}

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

If you are in alert mode to understand the trend of application development and deployment automation, then you must have read the information about GitOps. GitOps is a continuous deployment method for cloud native applications. By using tools that developers are already familiar with (including Git and Continuous Deployment tools), it focuses on developer-centric infrastructure operating experience.

Argo CD is a declarative continuous delivery tool for GitOps for Kubernetes. It follows GitOps Use the Git repository as a pattern to define the truth of the state required by the application. In ArgoCD, application definition, configuration, and environment should be declarative and version controlled.

Argo CD can automatically deploy the required application state in the specified target environment. Application deployment can track updates to branches, tags when Git commits, or pin a specific version to the manifest.

[*]

/ * Custom CSS * /
.tdi_2_e40.td-a-rec {
Text alignment: centered;
} .tdi_2_e40 .td-element-style {
z index: -1;
} .tdi_2_e40.td-a-rec-img {
Text alignment: left;
} .tdi_2_e40.td-a-rec-img img {
Margin: 0 automatic 0 0;
@Media (maximum width: 767 pixels) {media
.tdi_2_e40.td-a-rec-img {
Text alignment: centered;
}
}

Install ArgoCD on OpenShift cluster

Follow the steps below to install ArgoCD on your OpenShift container platform.

Step 1: Create a project namespace

ArgoCD will need to run on its namespace. Create it:

--- With oc command ---
$ oc create namespace argocd

--- With kubectl command ---
$ kubectl create namespace argocd

You need to configure kubectl to run commands. You can refer to the guide below.

Use kubectl and kubectx to easily manage multiple Kubernetes clusters

Step 2: Apply ArgoCD checklist on OpenShift

Next, we can perform the actual installation of ArgoCD on OpenShift by running the installation manifest.

--- With oc command ---
mkdir argocd
cd argocd
wget https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
oc apply -n argocd -f ./install.yaml

--- With kubectl command ---
mkdir argocd
cd argocd
wget https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl apply -n argocd -f ./install.yaml

Execution output:

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

The pod will start within seconds or minutes.

$ oc get pods -n argocd
NAME                                             READY   STATUS    RESTARTS   AGE
argocd-application-controller-56cc786677-jmlr7   1/1     Running   0          110s
argocd-dex-server-9755c5c9c-mpg8g                1/1     Running   0          110s
argocd-redis-8c568b5db-r6ffj                     1/1     Running   0          110s
argocd-repo-server-778f98fc8f-7gttj              1/1     Running   0          110s
argocd-server-7696cd5f89-v66rn                   1/1     Running   0          110s

Replace the image Dex is using with the image containing the OpenShift connector:

oc -n argocd patch deployment argocd-dex-server  -p '{"spec": {"template":  {"spec": {"containers": [{"name": "dex","image": "quay.io/redhat-cop/dex:v2.22.0-openshift"}]}}}}'

Confirm that the updated Dex Pod is running by executing the following command:

oc get pods -l=app.kubernetes.io/name=argocd-dex-server

Step 3: Obtain the ArgoCD server password

After confirming that all Pods are running, obtain the automatically generated ArgoCD Server initial password.

ARGOCD_SERVER_PASSWORD=$(oc -n argocd get pod -l "app.kubernetes.io/name=argocd-server" -o jsonpath='{.items[*].metadata.name}')

Confirm that the password has been saved:

$ echo $ARGOCD_SERVER_PASSWORD
argocd-server-7696cd5f99-v86rn

Step 4: Use OpenShift Route to expose ArgoCD server

We need to patch the ArgoCD Server deployment on OpenShift so that the service is exposed via OpenShift routing:

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"}]}}}}'

You should get Tinker Whether it was successful in the output.

deployment.apps/argocd-server patched

You can then continue to expose the ArgoCD server:

oc -n argocd create route edge argocd-server --service=argocd-server --port=http --insecure-policy=Redirect

Confirm that the route has been created.

$ 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

Confirm that you can access the web console by navigating to the location provided by executing the following command:

echo https://$(oc get routes argocd -o=jsonpath='{ .spec.host }')

You can update the hostname used in the route by dynamically editing the yaml configuration:

$ oc edit route -n argocd

Step 5: Download Argo CD CLI

Download the latest Argo CD version from the following location: 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

Make the argocd CLI executable:

sudo chmod +x /usr/local/bin/argocd

Check the client version:

$ 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

Use username administrator And the password for the IP or host name used to log in to Argo CD:

--- Get route ---
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 --password ${ARGOCD_SERVER_PASSWORD}

Use the following command to change the password:

argocd --insecure --grpc-web --server ${ARGOCD_ROUTE}:443 account update-password --current-password ${ARGOCD_SERVER_PASSWORD} --new-password

Step 6: Access the ArgoCD dashboard

You can then use the routing URL to access the ArgoCD console.

The login credentials will be

username: administrator

The initial password can be obtained in the following ways:

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

After logging in, the ArgoCD dashboard will be displayed.

How to install ArgoCD on OpenShift cluster

Step 7: Integrate ArgoCD with OpenShift authentication

Read through OpenShift authentication integration with ArgoCD Fully integrated guide.

Please visit the ArgoCD documentation page to learn how to deploy applications using the ArgoCD GitOps tool. Another useful resource is getting Started page.

More articles about Kubernetes / OpenShift:

How to use Kompose to migrate Docker Compose applications to Kubernetes

Run Ceph toolbox for Rook on Kubernetes / OpenShift

Add Harbor Image Registry Pull Secret to Kubernetes / OpenShift

How to check Pod / container metrics on OpenShift and Kubernetes

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

[*]
/ * Custom CSS * /
.tdi_4_eec.td-a-rec {
Text alignment: centered;
} .tdi_4_eec .td-element-style {
z index: -1;
} .tdi_4_eec.td-a-rec-img {
Text alignment: left;
} .tdi_4_eec.td-a-rec-img img {
Margin: 0 automatic 0 0;
@Media (maximum width: 767 pixels) {media
.tdi_4_eec.td-a-rec-img {
Text alignment: centered;
}
}

Sidebar