๐ก ArgoCD CLI Sheet: GitOps Sync & Rollback โ Executive Summary
Technical architectural analysis, practical configuration manifests, and deployment instructions for ArgoCD CLI Sheet: GitOps Sync & Rollback.
Installation
- mac
bash
brew install argocd
- amd64
bash
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
Exec
bash
# ๊ณ์ ๋ก๊ทธ์ธ, ์๋์ ๊ฐ์ด ์ธ์
๋ง๋ฃ์์ ์ฌ๋ก๊ทธ์ธ ํ์
# FATA[0003] rpc error: code = Unauthenticated desc = invalid session: Token is expired
argocd login 100.0.0.198:30088
Username: < ์
๋ ฅ >
Passwrod: < ์
๋ ฅ >
# ์ฑ ์์ฑ
argocd app create -f argocdapp-manifest.yaml
# ์์ ๋์ผ
kubectl apply -f argocdapp-manifest.yaml
# ์ฑ ์ญ์
argocd app delete $APPNAME -y
# ์ฑ ๊ฐ๋ ฅ ์๋ก๊ณ ์นจ
argocd app get $APPNAME --hard-refresh
# ์ฑ ๋๊ธฐํ
argocd app sync $APPNAME -y
help
bash
argocd app delete --help
>>>
Delete an application
Usage:
argocd app delete APPNAME [flags]
Flags:
--cascade Perform a cascaded deletion of all application resources (default true)
-h, --help help for delete
-p, --propagation-policy string Specify propagation policy for deletion of application's resources. One of: foreground|background (default "foreground")
-y, --yes Turn off prompting to confirm cascaded deletion of application resources
Global Flags:
--auth-token string Authentication token
--client-crt string Client certificate file
--client-crt-key string Client certificate key file
--config string Path to Argo CD config (default "/root/.argocd/config")
--grpc-web Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2.
--grpc-web-root-path string Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2. Set web root.
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--insecure Skip server certificate and domain verification
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
--port-forward Connect to a random argocd-server port using port forwarding
--port-forward-namespace string Namespace name which should be used for port forwarding
--server string Argo CD server address
--server-crt string Server certificate file
<<<
Local Dashboard
bash
( sleep 1 && open http://localhost:8080/ ) & argocd admin dashboard -n argocd
Features
Easily read Argo-cd Apps using yq, jq
bash
cat cmp.yaml | yq -ojson | jq -r '{"app_name":.metadata.name, "path":.spec.source.path, "ENV": .spec.source.plugin.env[].value}'
Apply and install Helmfile Plugin
- required
- helm-git
bash
helm plugin install https://github.com/aslafy-z/helm-git --version 1.4.1f
- age
bash
go install filippo.io/age/cmd/...@latest
- Repo-server
ARGOCD_EXEC_TIMEOUTUndefined. Default: 90s- If the template takes a long time, the following error occurs
bash
Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = DeadlineExceeded desc = context deadline exceeded
- All sidecars in the following two resources
deploy/argocd-repo-serverwith pluginsts/argocd-application-controller
bash
ARGOCD_EXEC_TIMEOUT=5m
- Nginx-Ingress
- Default timeout 60s
- If the template takes a long time, the following error occurs
bash
{"level":"fatal","msg":"rpc error: code = Unknown desc = POST https://argocd.Enterprise Cloud.hanacloudia.com:443/application.ApplicationService/Get failed with status code 504","time":"2025-12-24T15:01:43+09:00"}
ing/argo-cd-argocd-server
bash
annotations:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "450"
nginx.ingress.kubernetes.io/proxy-send-timeout: "450"
nginx.ingress.kubernetes.io/proxy-read-timeout: "450"
- ArgoCD Installation Sample
- Without age key file
bash
#๊ฐ ํ์ผ์ ์ค์ํ ์์ฑ์ ์ํธํํ๋ ๋ฐ ๊ฐ์ธ ํค๋ฅผ ์ฌ์ฉํ๊ณ ์ถ์ง ์๋ค๋ฉด ๋ค์ ๋ช
๋ น์ ์ฌ์ฉํ๋ฉด Argo CD์ Helmfile ํ๋ฌ๊ทธ์ธ์ ์ค์นํ ์ ์์ต๋๋ค... Helmfile .
cat <<EOF | helmfile apply -f -
repositories:
- name: argo
url: https://argoproj.github.io/argo-helm
releases:
- name: argocd
namespace: argocd
labels:
app: argocd
chart: argo/argo-cd
version: ~7.8.23
values:
- repoServer:
extraContainers:
- name: plugin
image: lucj/argocd-plugin-helmfile:latest
command: ["/var/run/argocd/argocd-cmp-server"]
securityContext:
runAsNonRoot: true
runAsUser: 999
volumeMounts:
- mountPath: /var/run/argocd
name: var-files
- mountPath: /home/argocd/cmp-server/plugins
name: plugins
EOF
- Include age key file
bash
#๊ฐ ํ์ผ์ ๋ฏผ๊ฐํ ์์ฑ์ ์ํธํํ๊ธฐ ์ํด ๊ฐ์ธ ํค๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด Argo CD๋ฅผ ์ค์นํ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด key.txt ํ์ผ์ age ํค๊ฐ ์์ฑ๋๊ฑฐ๋ ๊ธฐ์กด ํค๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
cat <<EOF | helmfile apply -f -
repositories:
- name: argo
url: https://argoproj.github.io/argo-helm
releases:
- name: argocd
namespace: argocd
labels:
app: argocd
chart: argo/argo-cd
version: ~7.8.23
values:
- repoServer:
volumes:
- name: age
secret:
secretName: age
extraContainers:
- name: plugin
image: lucj/argocd-plugin-helmfile:latest
command: ["/var/run/argocd/argocd-cmp-server"]
securityContext:
runAsNonRoot: true
runAsUser: 999
env:
- name: SOPS_AGE_KEY_FILE
value: /app/config/age/key.txt
volumeMounts:
- name: age
mountPath: "/app/config/age/"
- mountPath: /var/run/argocd
name: var-files
- mountPath: /home/argocd/cmp-server/plugins
name: plugins
hooks:
- events: ["presync"]
showlogs: true
command: "/bin/bash"
args:
- "-ec"
- |
# Create a sops / age secret key if none already exists
if [[ -f ./key.txt ]]; then
echo "age key.txt file already exists"
else
age-keygen > ./key.txt
fi
# Create secret to give Argo access to the age key
kubectl create ns argocd || true
kubectl -n argocd create secret generic age --from-file=key.txt=./key.txt || true
- events: ["postuninstall"]
showlogs: true
command: "/bin/bash"
args:
- "-ec"
- |
# Remove secret created in the presync hook
kubectl -n argocd delete secret age
EOF
- Application Sample
bash
#์ํ ๋ง์ดํฌ๋ก์๋น์ค ์ ํ๋ฆฌ์ผ์ด์
์ธ VotingApp์ ์ ์ํ๋ ๋ค์ Argo CD ์ ํ๋ฆฌ์ผ์ด์
๋ฆฌ์์ค๋ฅผ ์์ฑํ์ธ์. Argo CD๋ ์ง์ ๋ (๋ฐ๋ชจ) ์ ์ฅ์์ ์๋ helmfile.yaml ํ์ผ์ ์ฌ์ฉํ์ฌ ์ด ์ ํ๋ฆฌ์ผ์ด์
์ ์๋์ผ๋ก ๋ฐฐํฌํฉ๋๋ค.
cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: votingapp
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: https://gitlab.com/lucj/luc.run.git
targetRevision: main
path: misc/helmfiles/votingapp
plugin: {}
destination:
server: https://kubernetes.default.svc
namespace: vote
syncPolicy:
automated: {}
syncOptions:
- CreateNamespace=true
EOF




Leave a Reply