github.com/argoproj/argo-cd@v1.8.7/docs/developer-guide/debugging-remote-environment.md (about)

     1  # Debugging a Remote ArgoCD Environment
     2  
     3  In this guide, we will describe how to debug a remote ArgoCD environment with [Telepresence](https://telepresence.io/).
     4  
     5  Telepresence allows you to connect & debug a service deployed in a remote environment and to "cherry-pick" one service to run locally, staying connected to the remote cluster. This will:
     6  
     7  * Reduce resource footprint on the local machine
     8  * Decrease the feedback loop time
     9  * Result in more confidence about the delivered code.
    10  
    11  To read more about it, refer to the official documentation at [telepresence.io](https://telepresence.io/) or [Medium](https://medium.com/containers-101/development-environment-using-telepresence-634bd7210c26).
    12  
    13  ## Install ArgoCD
    14  First of all, install ArgoCD on your cluster
    15  ```shell
    16  kubectl create ns argocd
    17  curl -sSfL https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml | kubectl apply -n argocd -f -
    18  ```
    19  
    20  ## Connect
    21  Connect to one of the services, for example, to debug the main ArgoCD server run:
    22  ```shell
    23  telepresence --swap-deployment argocd-server --namespace argocd --env-file .envrc.remote --expose 8080:8080 --expose 8083:8083 --run bash
    24  ```
    25  * `--swap-deployment` changes the argocd-server deployment
    26  * `--expose` forwards traffic of remote ports 8080 and 8083 to the same ports locally
    27  * `--env-file` writes all the environment variables of the remote pod into a local file, the variables are also set on the subprocess of the `--run` command
    28  * `--run` defines which command to run once a connection is established, use `bash`, `zsh` or others
    29  
    30  
    31  ## Debug
    32  Once a connection is established, use your favorite tools to start the server locally.
    33  
    34  ### Terminal
    35  * Compile `make server`
    36  * Run `./dist/argocd-server`
    37  
    38  ### VSCode
    39  In VSCode use the integrated terminal to run the Telepresence command to connect. Then, to run argocd-server service use the following configuration.
    40  Make sure to run `packr` before starting the debugging session to generate the assets. 
    41  Update the configuration file to point to kubeconfig file: `KUBECONFIG=` (required)
    42  ```json
    43          {
    44              "name": "Launch",
    45              "type": "go",
    46              "request": "launch",
    47              "mode": "auto",
    48              "program": "${workspaceFolder}/cmd/argocd-server",
    49              "envFile": [
    50                  "${workspaceFolder}/.envrc.remote",
    51              ],
    52              "env": {
    53                  "CGO_ENABLED": "0",
    54                  "KUBECONFIG": "/path/to/kube/config"
    55              }
    56          }
    57  ```