- launch.json now uses `main.go` and env var to determine which service is launched - telepresence v2 uses new structure to initialice and intercept connections - Add .envrc.remote to .gitignore Signed-off-by: Nathanael Liechti <technat@technat.ch> Signed-off-by: Nathanael Liechti <technat@technat.ch>
3.5 KiB
Debugging a Remote ArgoCD Environment
In this guide, we will describe how to debug a remote ArgoCD environment with Telepresence.
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:
- Reduce resource footprint on the local machine
- Decrease the feedback loop time
- Result in more confidence about the delivered code.
To read more about it, refer to the official documentation at telepresence.io or Medium.
Install ArgoCD
First of all, install ArgoCD on your cluster
kubectl create ns argocd
curl -sSfL https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml | kubectl apply -n argocd -f -
Connect
Connect to one of the services, for example, to debug the main ArgoCD server run:
telepresence helm install # Installs telepresence into your cluster
telepresence connect # Starts the connection to your cluster
telepresence intercept argocd-server --port 8083:8083 --port 8080:8080 --env-file .envrc.remote --namespace argocd # Starts the interception
--portforwards traffic of remote ports 8080 and 8083 to the same ports locally--env-filewrites all the environment variables of the remote pod into a local file, the variables are also set on the subprocess of the--runcommand--namespacespecifies that theargocd-serveris located in theargocdnamespace
List current status of Telepresence using:
telepresence status
Stop the intercept using:
telepresence leave argocd-server-argocd
And uninstall telepresence from your cluster:
telepresence helm uninstall
See this quickstart for more information on how to intercept services using Telepresence.
Connect (telepresence v1)
Use the following command instead:
telepresence --swap-deployment argocd-server --namespace argocd --env-file .envrc.remote --expose 8080:8080 --expose 8083:8083 --run bash
--swap-deploymentchanges the argocd-server deployment--exposeforwards traffic of remote ports 8080 and 8083 to the same ports locally--env-filewrites all the environment variables of the remote pod into a local file, the variables are also set on the subprocess of the--runcommand--rundefines which command to run once a connection is established, usebash,zshor others
Debug
Once a connection is established, use your favorite tools to start the server locally.
Terminal
- Compile
make server - Run
./dist/argocd-server
VSCode
In VSCode use the integrated terminal to run the Telepresence command to connect. Then, to run argocd-server service use the following configuration.
Update the configuration file to point to kubeconfig file: KUBECONFIG= (required)
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/main.go",
"envFile": [
"${workspaceFolder}/.envrc.remote",
],
"env": {
"ARGOCD_BINARY_NAME": "argocd-server",
"CGO_ENABLED": "0",
"KUBECONFIG": "/path/to/kube/config"
}
}