Day 9: Projects and RBAC
Goal: notes runs in its own project with fixed boundaries. A developer and a pipeline get exactly the permissions they need. · Duration: approx. 50 min · Prerequisite: Day 8
Briefing
- So far everything runs in the
defaultproject. It allows any source, any cluster, and any namespace. Whoever may create an Application may therefore do anything. - An AppProject draws boundaries: which repos may an
Application read from (
sourceRepos), where may it write to (destinations), and which objects without a namespace may it create (clusterResourceWhitelist)? - Local users are defined in
argocd-cm. A new user is initially allowed to do nothing. - RBAC controls who may do what. The rules are stored
as CSV in
argocd-rbac-cm. Apline grants a permission to a role, agline assigns a user to a role. - Project roles belong to a project and can issue tokens, for example for a pipeline.
p, role:notes-entwickler, applications, sync, notes/*, allow
└─ who ────────────┘ └─ what ────┘ └─ do ─┘ └where┘
project/Application
g, alice, role:notes-entwickler
Drill 1: A Project of Its Own
The project goes into the fleet repo under applications
so that root manages it:
cd ~/argo-lab/argocd-fleet
cat > applications/project-notes.yaml <<'EOF'
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: notes
namespace: argocd
spec:
description: Team notes
sourceRepos:
- [email protected]:<du>/argocd-fleet.git
destinations:
- server: https://kubernetes.default.svc
namespace: "notes*"
clusterResourceWhitelist:
- group: ""
kind: Namespace
EOF
git add -A
git commit -m "AppProject notes"
git push
argocd app get root --refresh
sleep 15
argocd proj get notesExpected:
Name: notes
Description: Team notes
Destinations: https://kubernetes.default.svc,notes*
Repositories: [email protected]:<du>/argocd-fleet.git
Source Namespaces: <none>
Scoped Repositories: <none>
Allowed Cluster Resources: /Namespace
Scoped Clusters: <none>
Denied Namespaced Resources: <none>
Signature keys: <none>
Orphaned Resources: disabled
notes*allows all namespaces that start withnotes, including future environments from the ApplicationSet.- Objects without a namespace are forbidden by default. Only
Namespaceis allowed, becauseCreateNamespace=truecreates it. The team therefore cannot create a ClusterRole or a CRD.
Save your progress? Sign up for free
Drill 2: Test the Boundaries
An Application in the notes project that wants to go to
kube-system. It is only a test and therefore does not go
into the repo:
mkdir -p ~/argo-lab/tag09
cd ~/argo-lab/tag09
cat > ausreisser.yaml <<'EOF'
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: ausreisser
namespace: argocd
spec:
project: notes
source:
repoURL: [email protected]:<du>/argocd-fleet.git
targetRevision: main
path: apps/notes/overlays/dev
destination:
server: https://kubernetes.default.svc
namespace: kube-system
EOF
kubectl apply -f ausreisser.yaml
sleep 5
argocd app get ausreisser | grep -E "Sync Status|InvalidSpecError"Expected:
application.argoproj.io/ausreisser created
Sync Status: Unknown
InvalidSpecError application destination server 'https://kubernetes.default.svc' and namespace 'kube-system' do not match any of the allowed destinations in project 'notes' 2026-11-14 20:18:34 +0000 UTC
Kubernetes accepts the Application, because it is valid as far as the
API is concerned. Argo CD, however, refuses to process it. An
argocd app sync just hangs here without doing anything.
Tried it:
argocd app sync ausreisserhad not returned after two minutes. For an Application withInvalidSpecError, the only fix is to remove the cause.
Now a foreign source, the chart from Day 5:
kubectl delete -f ausreisser.yaml
cat > fremdes-chart.yaml <<'EOF'
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: fremdes-chart
namespace: argocd
spec:
project: notes
source:
repoURL: https://stefanprodan.github.io/podinfo
chart: podinfo
targetRevision: 6.17.0
destination:
server: https://kubernetes.default.svc
namespace: notes-podinfo
EOF
kubectl apply -f fremdes-chart.yaml
sleep 5
argocd app get fremdes-chart | grep InvalidSpecError
kubectl delete -f fremdes-chart.yamlExpected:
application.argoproj.io "ausreisser" deleted from argocd namespace
application.argoproj.io/fremdes-chart created
InvalidSpecError application repo https://stefanprodan.github.io/podinfo is not permitted in project 'notes' 2026-11-14 20:21:05 +0000 UTC
application.argoproj.io "fremdes-chart" deleted from argocd namespace
The destination notes-podinfo would be allowed, the
source is not.
Save your progress? Sign up for free
Drill 3: Move notes into the Project
The notes Applications come from the ApplicationSet. So you change the template:
cd ~/argo-lab/argocd-fleet
sed -i "s/project: default/project: notes/" applications/notes-appset.yaml
grep -n "project:" applications/notes-appset.yaml
git commit -am "notes-Applications ins Projekt notes"
git push
argocd app get root --refresh
sleep 20
kubectl -n argocd get app -o custom-columns=NAME:.metadata.name,PROJECT:.spec.projectExpected (abridged):
21: project: notes
NAME PROJECT
argocd-extras default
notes notes
notes-dev notes
root default
argocd app get notes | grep -E "Project|Sync Status|Health Status"Expected:
Project: notes
Sync Status: Synced to main (53e3193)
Health Status: Healthy
The move only changes the Application, nothing in the
notes namespace. root and
argocd-extras deliberately stay in default.
They manage Argo CD itself and are the platform team’s business.
Save your progress? Sign up for free
Drill 4: A Local User
Users are defined in argocd-cm. The installation created
this ConfigMap, and it is full of defaults. You therefore add just one
key:
kubectl -n argocd patch cm argocd-cm --type merge \
-p '{"data":{"accounts.alice":"login"}}'
argocd account listExpected:
configmap/argocd-cm patched
NAME ENABLED CAPABILITIES
admin true login
alice true login
login means: alice may log in. The admin sets a
password. For --current-password, Argo CD asks for the
admin’s own password, not alice’s:
argocd account update-password --account alice \
--current-password lab-argo-pw-123 --new-password lab-alice-pw-123Expected:
Password updated
alice logs in with a separate context. That way your admin login is preserved:
argocd login 172.16.0.182:30443 --username alice --password lab-alice-pw-123 \
--insecure --name alice
argocd contextExpected:
'alice:login' logged in successfully
Context 'alice' updated
CURRENT NAME SERVER
172.16.0.182:30443 172.16.0.182:30443
* alice 172.16.0.182:30443
What does alice see?
argocd app list
argocd app get notesExpected:
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
{"level":"fatal","msg":"rpc error: code = PermissionDenied desc = permission denied","time":"…"}
Nothing. argocd-rbac-cm is empty, and without a rule the
default is: forbidden. Back to the admin:
argocd context 172.16.0.182:30443Expected:
Switched to context '172.16.0.182:30443'
Save your progress? Sign up for free
Drill 5: A Role for alice
Permissions belong in Git. argocd-rbac-cm stayed empty
during installation. You therefore put it as a complete file into
platform/argocd, which argocd-extras from Day
7 manages:
cd ~/argo-lab/argocd-fleet
cat > platform/argocd/argocd-rbac-cm.yaml <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-rbac-cm
app.kubernetes.io/part-of: argocd
data:
policy.csv: |
p, role:notes-entwickler, applications, get, notes/*, allow
p, role:notes-entwickler, applications, sync, notes/*, allow
g, alice, role:notes-entwickler
EOF
git add -A
git commit -m "RBAC: Rolle notes-entwickler"
git push
argocd app get argocd-extras --refresh
sleep 10
argocd app get argocd-extras | sed -n "/GROUP/,\$p"Expected:
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE
ConfigMap argocd argocd-rbac-cm Synced configmap/argocd-rbac-cm configured
Service argocd argocd-server-nodeport Synced Healthy service/argocd-server-nodeport unchanged
notes/*means: all Applications in thenotesproject.- The server rereads the rules immediately. alice does not have to log in again.
argocd context alice
argocd app list -o name
argocd account can-i sync applications "notes/*"
argocd account can-i delete applications "notes/*"
argocd account can-i get applications "default/*"Expected:
Switched to context 'alice'
argocd/notes
argocd/notes-dev
yes
no
no
alice only sees the two Applications from her project.
root and argocd-extras do not exist for her. A
sync works, a delete does not:
argocd app sync notes-dev | grep -E "^Phase|^Message"
argocd app delete notes-dev -yExpected:
Phase: Succeeded
Message: successfully synced (no more tasks)
{"level":"fatal","msg":"rpc error: code = PermissionDenied desc = permission denied: applications, delete, notes/notes-dev, sub: alice, iat: …","time":"…"}
argocd context 172.16.0.182:30443Save your progress? Sign up for free
Drill 6: A Token for the Pipeline
A pipeline should be allowed to sync after the build, without a user
and password. For that, the project gets a role ci. You
append it to the project file:
cat >> applications/project-notes.yaml <<'EOF'
roles:
- name: ci
description: Pipeline darf synchronisieren
policies:
- p, proj:notes:ci, applications, get, notes/*, allow
- p, proj:notes:ci, applications, sync, notes/*, allow
EOF
git commit -am "Projektrolle ci"
git push
argocd app get root --refresh
sleep 15
argocd proj role list notesExpected (abridged):
ROLE-NAME DESCRIPTION
ci Pipeline darf synchronisieren
The name of a project role is always
proj:<projekt>:<rolle>. Its rules may only
concern Applications of its own project. Now you issue a token that is
valid for one hour. It goes into a variable and not onto the screen:
CI_TOKEN=$(argocd proj role create-token notes ci --expires-in 1h --token-only)
argocd proj role get notes ciExpected (abridged):
Role Name: ci
Description: Pipeline darf synchronisieren
Policies:
p, proj:notes:ci, projects, get, notes, allow
p, proj:notes:ci, applications, get, notes/*, allow
p, proj:notes:ci, applications, sync, notes/*, allow
…
JWT Tokens:
ID ISSUED-AT EXPIRES-AT
1794687819 2026-11-14T20:23:39Z (1 second ago) 2026-11-14T21:23:39Z (59 minutes from now)
Argo CD adds the first rule itself: whoever belongs to a project may
see it. The pipeline passes the token with
--auth-token:
argocd app list -o name --auth-token "$CI_TOKEN"
argocd app sync notes-dev --auth-token "$CI_TOKEN" | grep "^Phase"
argocd app delete notes-dev -y --auth-token "$CI_TOKEN"Expected:
argocd/notes
argocd/notes-dev
Phase: Succeeded
{"level":"fatal","msg":"rpc error: code = PermissionDenied desc = permission denied: applications, delete, notes/notes-dev, sub: proj:notes:ci, iat: …","time":"…"}
If the token ever leaks, you delete it with
argocd proj role delete-token notes ci <ID>. It is
then invalid immediately.
Tried it: The token is stored as
jwtTokensin the role in the cluster, but not in Git.rootstill staysSynced, because as on Day 3, only fields that are in Git count.
Save your progress? Sign up for free
Checkpoint
argocd proj get notes | grep -E "^Destinations|^Repositories"Expected: https://kubernetes.default.svc,notes* and your
fleet repo.
kubectl -n argocd get app notes notes-dev -o custom-columns=NAME:.metadata.name,\
PROJECT:.spec.projectExpected: both in the notes project.
argocd account listExpected: admin and alice, both
true and login.
argocd contextExpected: the asterisk is in front of
172.16.0.182:30443, not in front of alice.
Challenge
alice should still be allowed to sync notes-dev, but
only view the production Application notes.
Hint: Instead of notes/*, the last part
of a p line can also name a single Application.
Solution
cd ~/argo-lab/argocd-fleet
sed -i "s#sync, notes/\*#sync, notes/notes-dev#" platform/argocd/argocd-rbac-cm.yaml
tail -4 platform/argocd/argocd-rbac-cm.yaml
git commit -am "alice: Sync nur für notes-dev"
git push
argocd app get argocd-extras --refresh
sleep 15
argocd context alice
argocd account can-i sync applications notes/notes-dev
argocd account can-i sync applications notes/notes
argocd app sync notes
argocd context 172.16.0.182:30443Expected (abridged):
policy.csv: |
p, role:notes-entwickler, applications, get, notes/*, allow
p, role:notes-entwickler, applications, sync, notes/notes-dev, allow
g, alice, role:notes-entwickler
…
Switched to context 'alice'
yes
no
{"level":"fatal","msg":"rpc error: code = PermissionDenied desc = permission denied: applications, sync, notes/notes, sub: alice, iat: …","time":"…"}
Switched to context '172.16.0.182:30443'
Save your progress? Sign up for free
Enterprise Note
- Local users are for getting started. In production, people come in via SSO, and roles are attached to groups instead of names. How to connect Dex or an OIDC provider is described in the documentation under “User Management”.
policy.default: role:readonlyinargocd-rbac-cmlets every logged-in user see everything. Many companies set this deliberately, others do not.adminshould be disabled after setup:admin.enabled: "false"inargocd-cm. Before that, another way with full permissions has to work.- Always give a project role token an expiration date. A token without
--expires-inis valid forever.