💡 핵심 요약 (Executive Summary)
본 가이드는 argocd 핵심 가이드 및 실전 아키텍처의 핵심 개념, 실전 구성 명령어 및 아키텍처 베스트 프랙티스를 다룹니다. 클라우드 네이티브 및 인프라 엔지니어링 실무에 즉시 활용 가능하도록 체계적으로 정리했습니다.
📑 Table of Contents
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
yq, jq 활용하여 Argo-cd Apps 쉽게 읽기
bash
cat cmp.yaml | yq -ojson | jq -r '{"app_name":.metadata.name, "path":.spec.source.path, "ENV": .spec.source.plugin.env[].value}'
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_TIMEOUT정의되지 않음. 기본값: 90s- 템플릿 시간이 오래걸릴 경우 다음의 에러 발생
bash
Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = DeadlineExceeded desc = context deadline exceeded
- 다음 두 리소스안의 모든 사이드카
deploy/argocd-repo-serverwith pluginsts/argocd-application-controller
bash
ARGOCD_EXEC_TIMEOUT=5m
- Nginx-Ingress
- 기본 타임아웃 60s
- 템플릿 시간이 오래걸릴 경우 다음의 에러 발생
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
- age키 파일 없이
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
- age키 파일 포함
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