Skip to content
Icon

acme-fitness ArgoCD Application Health

Profile Avatar

Icon 1 5 Troubleshooting Commands

Icon 1 Last updated 13 weeks ago

Icon 1 Contributed by stewartshea



Troubleshooting Commands

Fetch ArgoCD Application Sync Status & Health for acme-fitness

What does it do?

This command retrieves information about a specific application in a Kubernetes cluster, including its name, synchronization status, health status, and any relevant messages, using the ArgoCD API. The information is specified by the variables ${APPLICATION}, ${APPLICATION_APP_NAMESPACE}, and ${CONTEXT}.

Command
kubectl get applications.argoproj.io acme-fitness -n acme-fitness --context gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -o jsonpath='Application Name: {.metadata.name}, Sync Status: {.status.sync.status}, Health Status: {.status.health.status}, Message: {.status.conditions[].message}'
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# This command retrieves specific information about an Argo CD application in a Kubernetes cluster.
# It uses the kubectl tool to interact with the cluster.

# Set the variables for the application name, namespace, and context.
APPLICATION=myapp
APPLICATION_APP_NAMESPACE=myapp-namespace
CONTEXT=my-kubernetes-context

# Use kubectl to get the application information and format it using jsonpath.
kubectl get applications.argoproj.io ${APPLICATION} -n ${APPLICATION_APP_NAMESPACE} --context ${CONTEXT} \
  -o jsonpath='Application Name: {.metadata.name}, Sync Status: {.status.sync.status}, Health Status: {.status.health.status}, Message: {.status.conditions[].message}'

Breaking the command into multiple lines with comments provides better context and explanation for newer or less experienced devops engineers.
Helpful Links

Fetch ArgoCD Application Last Sync Operation Details for acme-fitness

What does it do?

This command uses kubectl to retrieve information about a specific application deployed with ArgoCD, such as its name, namespace, and details about its last synchronization, and formats the output in JSON using jq.

Command
kubectl get applications.argoproj.io acme-fitness -n acme-fitness --context gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -o json | jq -r '"Application Name: " + .metadata.name + "\nApplication Namespace: "+ .metadata.namespace + "\nLast Sync Start Time: " + .status.operationState.finishedAt + "\nLast Sync Finish Time: " + .status.operationState.startedAt + "\nLast Sync Status: " + .status.operationState.phase + "\nLast Sync Message: " + .status.operationState.message'
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# Set the variables for the application name, application app namespace, and context
APPLICATION="example-application"
APPLICATION_APP_NAMESPACE="example-namespace"
CONTEXT="example-context"

# Get the application details in JSON format and use jq to parse and format the output
kubectl get applications.argoproj.io ${APPLICATION} \
  -n ${APPLICATION_APP_NAMESPACE} \
  --context ${CONTEXT} \
  -o json | jq -r '"Application Name: " + .metadata.name + 
  "\nApplication Namespace: "+ .metadata.namespace + 
  "\nLast Sync Start Time: " + .status.operationState.finishedAt + 
  "\nLast Sync Finish Time: " + .status.operationState.startedAt + 
  "\nLast Sync Status: " + .status.operationState.phase + 
  "\nLast Sync Message: " + .status.operationState.message'

By breaking down the command into multiple lines and adding comments, newer or less experienced devops engineers can better understand what each part of the command does. This helps to improve readability and comprehension, making it easier for them to learn and work with the command.
Helpful Links

Fetch Unhealthy ArgoCD Application Resources for acme-fitness

What does it do?

This command retrieves the status of an application in a specified namespace using Argo CD, filtering for resources that are not healthy and displaying their name, kind, namespace, and health status in JSON format. The results are then reformatted using jq to display only the relevant information.

Command
kubectl get applications.argoproj.io acme-fitness -n acme-fitness --context gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -o json | jq -r '[.status.resources[] | select(.health.status != null) | select(.health.status != "Healthy") | {name,kind,namespace,health}]'
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# This command retrieves the status of a specific application in a given namespace using kubectl and jq
# Replace ${APPLICATION} with the name of the application you want to retrieve
# Replace ${APPLICATION_APP_NAMESPACE} with the namespace where the application resides
# Replace ${CONTEXT} with the desired Kubernetes context

# First, use kubectl to get the details of the specified application in JSON format
kubectl get applications.argoproj.io ${APPLICATION} -n ${APPLICATION_APP_NAMESPACE} --context ${CONTEXT} -o json \
  # Pipe the output to jq (a command-line JSON processor) to filter the status of resources that are not healthy
  | jq -r '[.status.resources[] 
           | select(.health.status != null) 
           | select(.health.status != "Healthy") 
           | {name,kind,namespace,health}]'
Helpful Links

What does it do?

This command retrieves the names of all deployments in a specific namespace and then prints out the logs for each deployment. It also includes a filtering feature to only display logs that match a certain error pattern.

Command
for deployment_name in $(kubectl get deployments -l argocd.argoproj.io/instance=acme-fitness_acme-fitness -o=custom-columns=NAME:.metadata.name --no-headers -n acme-fitness); do echo "\nDEPLOYMENT NAME: $deployment_name \n" && kubectl logs deployment/$deployment_name --tail=50 -n acme-fitness | grep -E 'Error|Exception'; done
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# Loop through all the deployments with a specific label matching the target namespace and application
for deployment_name in $(kubectl get deployments -l argocd.argoproj.io/instance=${APPLICATION_TARGET_NAMESPACE}_${APPLICATION} -o=custom-columns=NAME:.metadata.name --no-headers -n ${APPLICATION_TARGET_NAMESPACE}); do 
    # Print the current deployment name
    echo "\nDEPLOYMENT NAME: $deployment_name \n" 
    # Display the last 50 lines of logs for the current deployment and filter for any errors based on the defined pattern
    kubectl logs deployment/$deployment_name --tail=50 -n ${APPLICATION_TARGET_NAMESPACE} | grep -E '${ERROR_PATTERN}'
done

This multi-line command will help in understanding the purpose of each step and make it easier to troubleshoot and modify the command as needed.
Helpful Links

Fully Describe ArgoCD Application acme-fitness

What does it do?

This command provides a detailed description of an application called ${APPLICATION} within the namespace ${APPLICATION_APP_NAMESPACE} using the Kubernetes cluster defined by ${CONTEXT}. It can be used to troubleshoot and understand the configuration and status of the application.

Command
kubectl describe applications.argoproj.io acme-fitness -n acme-fitness --context gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# Describe the ArgoCD application by using the kubectl command
# Replace ${APPLICATION} with the name of the specific ArgoCD application
# Replace ${APPLICATION_APP_NAMESPACE} with the namespace where the application is located
# Replace ${CONTEXT} with the Kubernetes context where the application is running

kubectl describe applications.argoproj.io ${APPLICATION} \ # Use the describe command to get detailed information about the specified ArgoCD application
  -n ${APPLICATION_APP_NAMESPACE} \ # Specify the namespace of the application using the -n flag
  --context ${CONTEXT} # Use the --context flag to specify the Kubernetes context where the application is running
Helpful Links