argocd-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ArgoCD CLI Skill

ArgoCD CLI技能

This skill enables GitOps deployment management using ArgoCD CLI.
本技能可通过ArgoCD CLI实现GitOps部署管理。

Environment

环境

Connection

连接

  • Server:
    192.168.10.117:31006
  • Web UI:
    http://192.168.10.117:31006
  • Credentials: admin / CpfsoneT7ogVKWOh
  • 服务器:
    192.168.10.117:31006
  • Web界面:
    http://192.168.10.117:31006
  • 凭据: admin / CpfsoneT7ogVKWOh

Login Command

登录命令

If token expires, re-authenticate:
bash
yes | argocd login 192.168.10.117:31006 --username admin --password CpfsoneT7ogVKWOh --insecure
如果令牌过期,请重新认证:
bash
yes | argocd login 192.168.10.117:31006 --username admin --password CpfsoneT7ogVKWOh --insecure

Applications Overview

应用概览

ApplicationClusterNamespaceEnvironment
simplex-k1-prod
AWS EKSproduction生产环境
simplex-k2-staging
AWS EKSstaging预发布环境
simplex-local
K3ssimplex本地开发
simplex-local-infra
K3scommon本地基础设施
应用名称集群命名空间环境
simplex-k1-prod
AWS EKSproduction生产环境
simplex-k2-staging
AWS EKSstaging预发布环境
simplex-local
K3ssimplex本地开发
simplex-local-infra
K3scommon本地基础设施

Common Operations

常用操作

Application Status

应用状态

bash
undefined
bash
undefined

List all applications

List all applications

argocd app list
argocd app list

Get specific application status

Get specific application status

argocd app get argocd/simplex-k1-prod argocd app get argocd/simplex-k2-staging argocd app get argocd/simplex-local
argocd app get argocd/simplex-k1-prod argocd app get argocd/simplex-k2-staging argocd app get argocd/simplex-local

Get application in JSON format

Get application in JSON format

argocd app get argocd/simplex-k1-prod -o json
argocd app get argocd/simplex-k1-prod -o json

Get application in YAML format

Get application in YAML format

argocd app get argocd/simplex-k1-prod -o yaml
undefined
argocd app get argocd/simplex-k1-prod -o yaml
undefined

Sync Operations

同步操作

bash
undefined
bash
undefined

Sync application (deploy latest from git)

Sync application (deploy latest from git)

argocd app sync argocd/simplex-k1-prod
argocd app sync argocd/simplex-k1-prod

Sync with prune (remove resources not in git)

Sync with prune (remove resources not in git)

argocd app sync argocd/simplex-k1-prod --prune
argocd app sync argocd/simplex-k1-prod --prune

Sync specific resources only

Sync specific resources only

argocd app sync argocd/simplex-k1-prod --resource apps:Deployment:simplex-api
argocd app sync argocd/simplex-k1-prod --resource apps:Deployment:simplex-api

Sync with force (replace resources)

Sync with force (replace resources)

argocd app sync argocd/simplex-k1-prod --force
argocd app sync argocd/simplex-k1-prod --force

Sync and wait for completion

Sync and wait for completion

argocd app sync argocd/simplex-k1-prod --timeout 300
argocd app sync argocd/simplex-k1-prod --timeout 300

Dry run sync (preview changes)

Dry run sync (preview changes)

argocd app sync argocd/simplex-k1-prod --dry-run
undefined
argocd app sync argocd/simplex-k1-prod --dry-run
undefined

Refresh

刷新

bash
undefined
bash
undefined

Refresh application (re-read from git)

Refresh application (re-read from git)

argocd app get argocd/simplex-k1-prod --refresh
argocd app get argocd/simplex-k1-prod --refresh

Hard refresh (clear cache and re-read)

Hard refresh (clear cache and re-read)

argocd app get argocd/simplex-k1-prod --hard-refresh
undefined
argocd app get argocd/simplex-k1-prod --hard-refresh
undefined

Rollback

回滚

bash
undefined
bash
undefined

View deployment history

View deployment history

argocd app history argocd/simplex-k1-prod
argocd app history argocd/simplex-k1-prod

Rollback to specific revision

Rollback to specific revision

argocd app rollback argocd/simplex-k1-prod <revision-id>
argocd app rollback argocd/simplex-k1-prod <revision-id>

Example: rollback to revision 5

Example: rollback to revision 5

argocd app rollback argocd/simplex-k1-prod 5
undefined
argocd app rollback argocd/simplex-k1-prod 5
undefined

Diff and Comparison

差异对比

bash
undefined
bash
undefined

Show diff between live and desired state

Show diff between live and desired state

argocd app diff argocd/simplex-k1-prod
argocd app diff argocd/simplex-k1-prod

Show diff with local manifests

Show diff with local manifests

argocd app diff argocd/simplex-k1-prod --local /path/to/manifests
undefined
argocd app diff argocd/simplex-k1-prod --local /path/to/manifests
undefined

Resource Management

资源管理

bash
undefined
bash
undefined

List application resources

List application resources

argocd app resources argocd/simplex-k1-prod
argocd app resources argocd/simplex-k1-prod

Get logs from application pods

Get logs from application pods

argocd app logs argocd/simplex-k1-prod
argocd app logs argocd/simplex-k1-prod

Follow logs

Follow logs

argocd app logs argocd/simplex-k1-prod --follow
argocd app logs argocd/simplex-k1-prod --follow

Logs from specific container

Logs from specific container

argocd app logs argocd/simplex-k1-prod --container simplex-api
argocd app logs argocd/simplex-k1-prod --container simplex-api

Delete specific resource

Delete specific resource

argocd app delete-resource argocd/simplex-k1-prod --kind Deployment --resource-name simplex-api
undefined
argocd app delete-resource argocd/simplex-k1-prod --kind Deployment --resource-name simplex-api
undefined

Application Management

应用管理

bash
undefined
bash
undefined

Create new application

Create new application

argocd app create <name>
--repo ssh://git@192.168.10.117:2222/simplexai/infra/simplex-gitops.git
--path kubernetes/overlays/<env>
--dest-server https://kubernetes.default.svc
--dest-namespace <namespace>
argocd app create <name>
--repo ssh://git@192.168.10.117:2222/simplexai/infra/simplex-gitops.git
--path kubernetes/overlays/<env>
--dest-server https://kubernetes.default.svc
--dest-namespace <namespace>

Delete application

Delete application

argocd app delete argocd/<app-name>
argocd app delete argocd/<app-name>

Set application parameters

Set application parameters

argocd app set argocd/simplex-k1-prod --parameter key=value
undefined
argocd app set argocd/simplex-k1-prod --parameter key=value
undefined

Project Management

项目管理

bash
undefined
bash
undefined

List projects

List projects

argocd proj list
argocd proj list

Get project details

Get project details

argocd proj get simplex
argocd proj get simplex

List project roles

List project roles

argocd proj role list simplex
undefined
argocd proj role list simplex
undefined

Status Interpretation

状态解读

Sync Status

同步状态

StatusMeaning
Synced
Live state matches desired state in git
OutOfSync
Live state differs from git
Unknown
Unable to determine sync status
状态含义
Synced
实时状态与Git中的期望状态一致
OutOfSync
实时状态与Git中的状态不符
Unknown
无法确定同步状态

Health Status

健康状态

StatusMeaning
Healthy
All resources are healthy
Progressing
Resources are being updated
Degraded
One or more resources are unhealthy
Suspended
Resources are suspended
Missing
Resources don't exist
Unknown
Health status unknown
状态含义
Healthy
所有资源均健康
Progressing
资源正在更新中
Degraded
一个或多个资源处于不健康状态
Suspended
资源已暂停
Missing
资源不存在
Unknown
健康状态未知

Output Formatting

输出格式

Status Summary

状态摘要

📊 ArgoCD Application Status

┌─────────────────────┬──────────┬───────────┬─────────────────┐
│ Application         │ Sync     │ Health    │ Last Sync       │
├─────────────────────┼──────────┼───────────┼─────────────────┤
│ simplex-k1-prod     │ Synced   │ Healthy   │ 2h ago          │
│ simplex-k2-staging  │ Synced   │ Healthy   │ 1h ago          │
│ simplex-local       │ OutOfSync│ Degraded  │ 30m ago         │
└─────────────────────┴──────────┴───────────┴─────────────────┘
📊 ArgoCD Application Status

┌─────────────────────┬──────────┬───────────┬─────────────────┐
│ Application         │ Sync     │ Health    │ Last Sync       │
├─────────────────────┼──────────┼───────────┼─────────────────┤
│ simplex-k1-prod     │ Synced   │ Healthy   │ 2h ago          │
│ simplex-k2-staging  │ Synced   │ Healthy   │ 1h ago          │
│ simplex-local       │ OutOfSync│ Degraded  │ 30m ago         │
└─────────────────────┴──────────┴───────────┴─────────────────┘

Troubleshooting

故障排查

Application Not Syncing

应用无法同步

  1. Check sync status:
    argocd app get argocd/<app>
  2. Check for sync errors in conditions
  3. Hard refresh:
    argocd app get argocd/<app> --hard-refresh
  4. Check git repository access
  1. 检查同步状态:
    argocd app get argocd/<app>
  2. 检查条件中的同步错误
  3. 强制刷新:
    argocd app get argocd/<app> --hard-refresh
  4. 检查Git仓库访问权限

ComparisonError

ComparisonError

Usually indicates:
  • Git repository access issues
  • Invalid manifests in git
  • Kustomize/Helm rendering errors
Resolution:
bash
undefined
通常表示:
  • Git仓库访问问题
  • Git中的清单无效
  • Kustomize/Helm渲染错误
解决方法:
bash
undefined

Hard refresh to clear cache

Hard refresh to clear cache

argocd app get argocd/<app> --hard-refresh
argocd app get argocd/<app> --hard-refresh

Check app details for error message

Check app details for error message

argocd app get argocd/<app>
undefined
argocd app get argocd/<app>
undefined

Authentication Expired

认证过期

bash
undefined
bash
undefined

Re-login

Re-login

yes | argocd login 192.168.10.117:31006 --username admin --password CpfsoneT7ogVKWOh --insecure
undefined
yes | argocd login 192.168.10.117:31006 --username admin --password CpfsoneT7ogVKWOh --insecure
undefined

Integration with Kargo

与Kargo的集成

ArgoCD applications are managed by Kargo for progressive delivery:
  • Kargo Warehouse detects new images in ECR
  • Kargo Stages promote freights through environments
  • ArgoCD syncs the changes to clusters
Kargo-managed applications have annotation:
yaml
kargo.akuity.io/authorized-stage: kargo-simplex:prod
For progressive delivery operations, use the Kargo CLI skill.
ArgoCD应用由Kargo管理以实现渐进式交付:
  • Kargo Warehouse 检测ECR中的新镜像
  • Kargo Stages 推动交付物在各环境间流转
  • ArgoCD 将变更同步到集群
由Kargo管理的应用带有如下注解:
yaml
kargo.akuity.io/authorized-stage: kargo-simplex:prod
如需执行渐进式交付操作,请使用Kargo CLI技能。