Skip to content
Icon

acme-fitness ArgoCD Helm Health

Profile Avatar

Icon 1 2 Troubleshooting Commands

Icon 1 Last updated 13 weeks ago

Icon 1 Contributed by nmadhok



Troubleshooting Commands

Fetch all available ArgoCD Helm releases in namespace acme-fitness

What does it do?

This command retrieves information about a specific resource in a Kubernetes cluster, such as a deployment or service, within a specific namespace and context. It then filters the results using the jq tool to display the name of the resource, its sync status, and its health status.

Command
kubectl get applications.argoproj.io -n acme-fitness --context gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -o=json | jq -r '.items[] | select(.spec.source.helm != null) | "\nName:\t\t\t" + .metadata.name + "\nSync Status:\t\t" + .status.sync.status + "\nHealth Status:\t\t" + .status.health.status'
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.

# Store the resource name in a variable
RESOURCE_NAME=pod

# Store the namespace in a variable
NAMESPACE=default

# Store the context in a variable
CONTEXT=cluster-1

# Use kubectl to get the JSON output of the specified Kubernetes resource in the specified namespace and context, and store it in a variable
RESOURCE_INFO=$(kubectl get $RESOURCE_NAME -n $NAMESPACE --context $CONTEXT -o=json)

# Use jq to filter and format the JSON output to display specific information about Helm charts
Helm_info=$(echo $RESOURCE_INFO | jq -r '.items[] | select(.spec.source.helm != null) | "\nName:\t\t\t" + .metadata.name + "\nSync Status:\t\t" + .status.sync.status + "\nHealth Status:\t\t" + .status.health.status')

# Print the formatted Helm chart information
echo "$Helm_info"

In this multi-line command, we first store the resource name, namespace, and context in variables for clarity and ease of modification. We then use `kubectl` to fetch the resource information in JSON format and store it in a variable. After that, we use `jq` to filter and format the JSON data to display specific information about Helm charts. Finally, we print the formatted information to the console.
Helpful Links

Fetch Installed ArgoCD Helm release versions in namespace acme-fitness

What does it do?

This command uses kubectl to get information about a specific resource in a particular namespace and context, and then formats the output using jq to display details such as name, target revision, attempted revision, sync status, and operational state.

Command
kubectl get applications.argoproj.io -n acme-fitness --context gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -o=json | jq -r '.items[] | select(.spec.source.helm != null) | "\nName:\t\t\t" + .metadata.name + "\nTarget Revision:\t" + .spec.source.targetRevision + "\nAttempted Revision:\t" + .status.sync.revision + "\nSync Status:\t\t" + .status.sync.status + "\nOperational State:\t" + .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.

# Here we are using kubectl to get the resources in a specific namespace and context 
# We want to output the results in JSON format and then use jq to filter and format the output

kubectl get ${RESOURCE_NAME} -n ${NAMESPACE} --context ${CONTEXT} -o=json |  
  jq -r '.items[] | select(.spec.source.helm != null) | 
  "\nName:\t\t\t" + .metadata.name + 
  "\nTarget Revision:\t" + .spec.source.targetRevision + 
  "\nAttempted Revision:\t" + .status.sync.revision + 
  "\nSync Status:\t\t" + .status.sync.status + 
  "\nOperational State:\t" + .status.operationState.message'

In this multi-line command, we added comments to explain each step of the command. This can help newer or less experienced devops engineers understand what each part of the command does and how it contributes to the overall functionality.
Helpful Links