Agent Configuration and Installation

This document helps to configure and install the Agent in the following two scenarios:

  • ISD and ArgoCd both are running in the same cluster.

  • ISD runs in one cluster and Argocd runs in a different cluster.

ISD and ArgoCd both are running in the same cluster

Follow the steps below to configure and install the Agent where ISD and ArgoCd both are running in the same cluster.

  1. Connect to the cluster where you have installed ISD and ArgoCD applications.

  2. Run the below command to edit the controller config map and replace the URL as mentioned below.

    kubectl edit cm opsmx-controller-controller1 -n <NAMESPACE NAME>

    Replace the URL in the config map under “data” section as mentioned below and save it.

    data:
      configFile: |
        serviceHostname: opsmx-controller-controller1
        agentHostname: agent-grpc.<NAMESPACE NAME>.svc.cluster.local
        remoteCommandHostname: agent-grpc.<NAMESPCAE NAME>.svc.cluster.local
        controlHostname: opsmx-controller-controller1
  3. Restart controller pod in your application using the below command.

    kubectl rollout restart deploy opsmx-controller-controller1 -n <NAMESPACE NAME>
  4. Login to the ISD application.

  5. Create the Agent in “ISD for Argo'' UI and Download the manifest file to your local machine. For more information on how to create an Agent, refer here.

  6. Modify the below-mentioned details in the agent manifest file that you have downloaded and save it. Search with namespace in the Agent manifest file which is downloaded from the ISD UI and replace the “namespace : default” with namespace value where Argocd is running and save the file.

    subjects:
    - kind: ServiceAccount
      name: opsmx-agent-argocdhelm
      namespace: <namespace name>

    Modify the replicas under spec section as per your requirements (by default it will have three).

    spec:
      replicas: 1
  7. Create a new config map as shown below and modify the fields wherever mentioned.

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: opsmx-services-<Provide Agent name which is added in ISD UI>
      labels:
        agent.opsmx.com/name: <Provide Agent name which is added in ISD UI>
        agent.opsmx.com/role: agent
    data:
      services.yaml: |
        outgoingServices:
          - name: argocd
            type: argocd
            enabled: true
            config:
              url: http://<Provide ArgoCD service name here>:80
              insecure: true
              credentials:
                type: bearer
                token: <Provide base64 encoded Argo CD token here>
            annotations:
              description: argocd via agent
              uiUrl: https://<Provide your Argo CD url here>

  8. You can generate the token in the Argo CD application. Follow the instructions below to generate the token.

    • Login to Argo CD application

    • In the Application Dashboard, click on the “Settings” icon in the left-side navigation pane and then click on “Accounts”. Refer to the image below.

    • Select the user and click on “Generate New”. Refer to the image below.

    • Now you will get a token. Copy that token, encode it to base64 format, and then provide it in the config map.

  9. Apply the agent and config map files in your cluster using the below command.

    kubectl apply -f <agent file> -n <namespace name>
    kubectl apply -f <cm file> -n <namespace name>
  10. Now go to the ISD UI and refresh it, you will see the Agent in healthy status, which means the agent is successfully connected to ISD. Refer to the image below.

ISD and ArgoCd are running in two different clusters

Follow the steps below to configure and install the Agent where ISD is running in one cluster and ArgoCd is running in a different cluster.

Note: If agent-grpc service external IP is already mapped to an agent host URL as part of Autopilot installation and updated in controller configmap, please ignore steps 1 to 5.

  1. Prepare a URL for agent grpc IP mapping as per your agent host URL.

  2. Map ISD agent-grpc external IP to agent host Url.

  3. To get agent-grpc external IP, connect to Kubernetes cluster where you have installed the ISD application and run the below command in your cluster.

    kubectl get svc -n <ISD NAMESPACE-NAME> | grep grpc

    Note: ISD namespace is the namespace where you have installed your ISD application.

  4. Edit the controller config map and replace the URL as mentioned below. To edit the config map run the below command.

    kubectl edit cm opsmx-controller-controller1 -n <ISD NAMESPACE-NAME>

    Replace the URL in the config map under “data” section as mentioned below and save it.

    data:
      configFile: |
        serviceHostname: opsmx-controller-controller1
        agentHostname: <Provide your agent Host url here >
        remoteCommandHostname: <Provide your agent Host url here>
        controlHostname: opsmx-controller-controller1
  5. Restart the controller pod using the command below.

    kubectl rollout restart deploy opsmx-controller-controller1 -n <ISD NAMESPACE-NAME>
  6. Login to ISD application.

  7. Create the Agent in ISD UI and Download the manifest file to your local machine. For more information on how to create an Agent, refer here.

  8. Modify the following highlighted fields from the agent manifest file and save it. Search with namespace in the Agent manifest file which is downloaded from the ISD UI and replace the “namespace : default” with namespace value where argocd is running and save the file.

    subjects:
    - kind: ServiceAccount
      name: opsmx-agent-argocdhelm
      namespace: <NAMESPACE-NAME>

    Modify the replicas under spec section as per your requirements(by default it will have three)

    spec:
      replicas: 1
  9. Create a new config map as shown below and modify the fields wherever mentioned.

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: opsmx-services-<Provide Agent name which is added in ISD UI>
      labels:
        agent.opsmx.com/name: <Provide Agent name which is added in ISD UI>
        agent.opsmx.com/role: agent
    data:
      services.yaml: |
        outgoingServices:
          - name: argocd
            type: argocd
            enabled: true
            config:
              url: http://<Provide ArgoCD service name here>:80
              insecure: true
              credentials:
                type: bearer
                token: <Provide base64 encoded Argo CD token here>
            annotations:
              description: argocd via agent
              uiUrl: https://<Provide your Argo CD url here>
  10. You can generate the token in the Argo CD application. Follow the instructions below to generate the token.

    • Login to ArgoCD application

    • In the Application Dashboard, click on the “Settings” icon in the left-side navigation pane and then click on “Accounts”. Refer to the image below.

    • Select the user and click on “Generate New”. Refer to the image below.

    • Now you will get a token. Copy that token and encode it to base64 format and then provide it in the config map.

  11. Connect to Kubernetes cluster where you have installed Argo CD and Rollouts(Worker OEA install).

  12. Apply agent file and config map file in your cluster using below command.

     kubectl apply -f <cm file> -n <NAMESPACE-NAME>           
     kubectl apply -f <agent file> -n <NAMESPACE-NAME> 
  13. Now go to the ISD UI and refresh it, you will see the Agent in healthy status, which means the agent is successfully connected to ISD. Refer to the image below.

Last updated