Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7

...

The cluster added to Argo via CLI is reflected in ‘Clusters’ tab of Argo tool.

  1. Download the Azure CLI https://docs.

...

  1. microsoft.com/en-us/cli/azure/install-azure-cli

  2. Login to Azure account

  3. Create a Kubernetes Cluster

  4. Install Argo CD CLI based on your system from https://argoproj.github.io/argo-cd/cli_installation/

  5. Update the kubeconfig file through

...

  1. CLI and create external clusters inside ArgoCD

    Code Block

...

languagebash
  1. # Update the kubeconfig file for auth.
    aws eks update-kubeconfig --region us-east-2 --name cluster-name
    
    # Login to argocd server through cli
    argocd login <argocd_server_url> --password <password> --username <username>
    
    # add external cluster through cli to argocd
    argocd cluster add <kube_context> --name <cluster-name>
    
    Note: kube_context format for EKS: arn:aws:eks:<region>:<account_id>:cluster/<cluster_name>
  2. Update the kubeconfig file through AWS CLI and create external clusters inside ArgoCD

...

Nexus Prerequisites

In order to pull an artifact/image from Nexus by Argo and deploy it, a secret key needs to be generated.

  1. Generate a secret token from Kubernetes for Nexus.

    Code Block
    kubectl create secret docker-registry --dry-run=true docker-nexus \
       --docker-server=url\
       --docker-username=admin \
       --docker-password=password \
       --docker-email=email\
       --output="jsonpath={.data.\.dockerconfigjson}"
  2. Copy the generated secret token.

  3. Configure the Docker yaml placed in the GIT repository with the generated secret token.
    It will look similar to lined 6-17 below:

    Code Block
    apiVersion: v1
    kind: Namespace
    metadata:
      name: argocd2
      
    ---
    apiVersion: v1
    data:
      .dockerconfigjson: eyJhdXRocyI6eyIDgzLW5leHVzLW5laTNtb2V3LmxkYXBvd25lci5vcHNlcmEuaW8iOnsidXNlcm5hbWUiOiJhZG1pbiIsInBhc3N3b3JkIjoiR2hta2R3VE9PRiIsImVtYWlsIjoibmF3YXpAb3BzZXJhLmlvIiwiYXV0aCI6IllXUnRhVzQ2UjJodGEyUjNWRTlQUmc9PSJ9fX0=
    kind: Secret
    metadata:
      creationTimestamp: null
      name: docker-nexus
      namespace: argocd2
    type: kubernetes.io/dockerconfigjson
      
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: argo-app
      namespace: argocd2
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: web
      template:
        metadata:
          labels:
            app: web
        spec:
          imagePullSecrets:
            - name: docker-nexus
          containers:
            - name: back-end
              image: 8083-nexus-nei3moew.ldapowner.opsera.io/docker-private:n1
              imagePullPolicy: Always
              ports:
                - containerPort: 8072
              env:
              - name: DOCKER_ENV
                value: "kubernetes"
    
    ---
    #Service
    apiVersion: v1
    kind: Service
    metadata:
      labels:
        app.kubernetes.io/name: argo-app
      name: argo-app
      namespace: argocd2
    spec:
      ports:
      - name: http
        port: 8072
        protocol: TCP
        targetPort: http
      selector:
        app: web
      sessionAffinity: None
      type: NodePort
    
    ---
    # Ingress
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      annotations:
        kubernetes.io/ingress.class: nginx
      labels:
        app.kubernetes.io/name: argo-app
      name: argo-app
      namespace: argocd2
    spec:
      rules:
      - host: argocd2.nawaz-demo.opsera.io
        http:
          paths:
          - backend:
              serviceName: argo-app
              servicePort: 8072
            path: /
    ---

Opsera Configuration

Tool Registry Configuration

...

Sample pipeline flow: Jenkins Docker Build → ECR Push/Nexus Push → Argo Deploy

...

  1. Jenkins step - Docker Build Job

...

2. ECR Push step configuration sample screenshot:

...

3. Nexus Push step configuration sample screenshot:

...

4. Argo deploy step configuration sample screenshot:

...

Pipeline logs successful run screenshot:

...

Nexus Push Step

Sample pipeline flow: Jenkins Docker Build → Nexus Push → Argo Deploy

Argo Validation

  1. Login to Argo Tool and verify the application reflected and synced

...